You are here

public function ErrorCollection::__construct in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/jsonapi/src/JsonApiResource/ErrorCollection.php \Drupal\jsonapi\JsonApiResource\ErrorCollection::__construct()

Instantiates an ErrorCollection object.

Parameters

\Symfony\Component\HttpKernel\Exception\HttpExceptionInterface[] $errors: The errors.

File

core/modules/jsonapi/src/JsonApiResource/ErrorCollection.php, line 37

Class

ErrorCollection
To be used when the primary data is `errors`.

Namespace

Drupal\jsonapi\JsonApiResource

Code

public function __construct(array $errors) {
  assert(Inspector::assertAll(function ($error) {
    return $error instanceof HttpExceptionInterface;
  }, $errors));
  $this->errors = $errors;
}