lib: Replace Repsonse::sendJson() w/ Response::json()

refs #9606
This commit is contained in:
Eric Lippmann 2015-09-07 13:24:21 +02:00
parent a9cb8bfb2c
commit 25abc16e15
1 changed files with 11 additions and 13 deletions

View File

@ -3,9 +3,9 @@
namespace Icinga\Web;
use Zend_Controller_Action_HelperBroker;
use Zend_Controller_Response_Http;
use Icinga\Application\Icinga;
use Icinga\Web\Response\JsonResponse;
class Response extends Zend_Controller_Response_Http
{
@ -97,6 +97,16 @@ class Response extends Zend_Controller_Response_Http
return $this;
}
/**
* Entry point for HTTP responses in JSON format
*
* @return JsonResponse
*/
public static function json()
{
return new JsonResponse();
}
/**
* Prepare the request before sending
*/
@ -146,16 +156,4 @@ class Response extends Zend_Controller_Response_Http
$this->prepare();
return parent::sendHeaders();
}
/**
* Immediately respond w/ the given data encoded in JSON
*
* @param array $data
*/
public function sendJson(array $data)
{
$helper = Zend_Controller_Action_HelperBroker::getStaticHelper('json');
/** @var \Zend_Controller_Action_Helper_Json $helper */
$helper->sendJson($data);
}
}