You are here

public function JsonResponse::__construct in Zircon Profile 8.0

Same name in this branch
  1. 8.0 vendor/symfony/http-foundation/JsonResponse.php \Symfony\Component\HttpFoundation\JsonResponse::__construct()
  2. 8.0 vendor/zendframework/zend-diactoros/src/Response/JsonResponse.php \Zend\Diactoros\Response\JsonResponse::__construct()
Same name and namespace in other branches
  1. 8 vendor/symfony/http-foundation/JsonResponse.php \Symfony\Component\HttpFoundation\JsonResponse::__construct()

Constructor.

Parameters

mixed $data The response data:

int $status The response status code:

array $headers An array of response headers:

Overrides Response::__construct

File

vendor/symfony/http-foundation/JsonResponse.php, line 41

Class

JsonResponse
Response represents an HTTP response in JSON format.

Namespace

Symfony\Component\HttpFoundation

Code

public function __construct($data = null, $status = 200, $headers = array()) {
  parent::__construct('', $status, $headers);
  if (null === $data) {
    $data = new \ArrayObject();
  }
  $this
    ->setData($data);
}