Neomerx\JsonApi\Contracts\Http\ResponsesInterface::getErrorResponse PHP Метод

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
    public function getErrorResponse($errors, $statusCode = self::HTTP_BAD_REQUEST, array $headers = []);

Usage Example

Пример #1
0
 /**
  * @inheritdoc
  */
 public function errors(ErrorResponseInterface $errors)
 {
     return $this->responses->getErrorResponse($errors->getErrors(), $errors->getHttpCode(), $errors->getHeaders());
 }