function ErrorCollection::__construct

Same name in other branches
  1. 9 core/modules/jsonapi/src/JsonApiResource/ErrorCollection.php \Drupal\jsonapi\JsonApiResource\ErrorCollection::__construct()
  2. 10 core/modules/jsonapi/src/JsonApiResource/ErrorCollection.php \Drupal\jsonapi\JsonApiResource\ErrorCollection::__construct()
  3. 11.x 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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.