You are here

public static function JsonResponse::create in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/http-foundation/JsonResponse.php \Symfony\Component\HttpFoundation\JsonResponse::create()

Factory method for chainability.

Example:

return Response::create($body, 200) ->setSharedMaxAge(300);

Parameters

mixed $content The response content, see setContent():

int $status The response status code:

array $headers An array of response headers:

Return value

Response

Overrides Response::create

11 calls to JsonResponse::create()
JsonResponseTest::testCreate in vendor/symfony/http-foundation/Tests/JsonResponseTest.php
JsonResponseTest::testSetContent in vendor/symfony/http-foundation/Tests/JsonResponseTest.php
@expectedException \InvalidArgumentException
JsonResponseTest::testSetContentJsonSerializeError in vendor/symfony/http-foundation/Tests/JsonResponseTest.php
@expectedException \Exception @expectedExceptionMessage This error is expected
JsonResponseTest::testStaticCreateAddsContentTypeHeader in vendor/symfony/http-foundation/Tests/JsonResponseTest.php
JsonResponseTest::testStaticCreateEmptyJsonObject in vendor/symfony/http-foundation/Tests/JsonResponseTest.php

... See full list

File

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

Class

JsonResponse
Response represents an HTTP response in JSON format.

Namespace

Symfony\Component\HttpFoundation

Code

public static function create($data = null, $status = 200, $headers = array()) {
  return new static($data, $status, $headers);
}