PHP Интерфейс Neomerx\JsonApi\Contracts\Http\ResponsesInterface

Показать файл Открыть проект Примеры использования интерфейса

Открытые методы

Метод Описание
getCodeResponse ( integer $statusCode, array $headers = [] ) : mixed Get response with HTTP code only.
getContentResponse ( object | array $data, integer $statusCode = self::HTTP_OK, array | null $links = null, mixed $meta = null, array $headers = [] ) : mixed Get response with regular JSON API Document in body.
getCreatedResponse ( object $resource, array | null $links = null, mixed $meta = null, array $headers = [] ) : mixed Get response for newly created resource with HTTP code 201 (adds 'location' header).
getErrorResponse ( Neomerx\JsonApi\Contracts\Document\ErrorInterface | Neomerx\JsonApi\Contracts\Document\ErrorInterface[] | ErrorCollection $errors, integer $statusCode = self::HTTP_BAD_REQUEST, array $headers = [] ) : mixed Get response with JSON API Error in body.
getIdentifiersResponse ( object | array $data, integer $statusCode = self::HTTP_OK, array | null $links = null, mixed $meta = null, array $headers = [] ) : mixed Get response with only resource identifiers.
getMetaResponse ( array | object $meta, integer $statusCode = self::HTTP_OK, array $headers = [] ) : mixed Get response with meta information only.

Описание методов

getCodeResponse() публичный Метод

Get response with HTTP code only.
public getCodeResponse ( integer $statusCode, array $headers = [] ) : mixed
$statusCode integer
$headers array
Результат mixed

getContentResponse() публичный Метод

Get response with regular JSON API Document in body.
public getContentResponse ( object | array $data, integer $statusCode = self::HTTP_OK, array | null $links = null, mixed $meta = null, array $headers = [] ) : mixed
$data object | array
$statusCode integer
$links array | null
$meta mixed
$headers array
Результат mixed

getCreatedResponse() публичный Метод

Get response for newly created resource with HTTP code 201 (adds 'location' header).
public getCreatedResponse ( object $resource, array | null $links = null, mixed $meta = null, array $headers = [] ) : mixed
$resource object
$links array | null
$meta mixed
$headers array
Результат mixed

getErrorResponse() публичный Метод

Get response with JSON API Error in body.
public getErrorResponse ( Neomerx\JsonApi\Contracts\Document\ErrorInterface | Neomerx\JsonApi\Contracts\Document\ErrorInterface[] | ErrorCollection $errors, integer $statusCode = self::HTTP_BAD_REQUEST, array $headers = [] ) : mixed
$errors Neomerx\JsonApi\Contracts\Document\ErrorInterface | Neomerx\JsonApi\Contracts\Document\ErrorInterface[] | Neomerx\JsonApi\Exceptions\ErrorCollection
$statusCode integer
$headers array
Результат mixed

getIdentifiersResponse() публичный Метод

Get response with only resource identifiers.
public getIdentifiersResponse ( object | array $data, integer $statusCode = self::HTTP_OK, array | null $links = null, mixed $meta = null, array $headers = [] ) : mixed
$data object | array
$statusCode integer
$links array | null
$meta mixed
$headers array
Результат mixed

getMetaResponse() публичный Метод

Get response with meta information only.
public getMetaResponse ( array | object $meta, integer $statusCode = self::HTTP_OK, array $headers = [] ) : mixed
$meta array | object Meta information.
$statusCode integer
$headers array
Результат mixed