Source for file JsonResponse.php
Documentation is available at JsonResponse.php
6: * @copyright Copyright (c) 2004, 2010 David Grudl
7: * @license http://nettephp.com/license Nette license
8: * @link http://nettephp.com
10: * @package Nette\Application
16: * JSON response used for AJAX requests.
18: * @copyright Copyright (c) 2004, 2010 David Grudl
19: * @package Nette\Application
23: /** @var array|stdClass*/
27: private $contentType;
32: * @param array|stdClass payload
33: * @param string MIME content type
37: if (!is_array($payload) &&
!($payload instanceof
stdClass)) {
38: throw new InvalidArgumentException("Payload must be array or anonymous class, " .
gettype($payload) .
" given.");
40: $this->payload =
$payload;
41: $this->contentType =
$contentType ?
$contentType :
'application/json';
47: * @return array|stdClass
51: return $this->payload;
57: * Sends response to output.