<?php
namespace Engine\Mvc\Response\Components;

class JsonBody extends Body
{
	public function __construct($body)
	{
		$this->body = ($body?:new \stdClass());
	}

	public function append($body)
	{
		throw new \Exception("You cannot append data on a json reponse");
	}

	public function asString()
	{
		return json_encode((object)$this->body);
	}
}
