Art4\JsonApiClient\ErrorCollection::parse PHP Method

parse() public method

Parses the data for this element
public parse ( $errors ) : self
return self
    public function parse($errors)
    {
        if (!is_array($errors)) {
            throw new ValidationException('Errors for a collection has to be in an array, "' . gettype($errors) . '" given.');
        }
        if (count($errors) === 0) {
            throw new ValidationException('Errors array cannot be empty and MUST have at least one object');
        }
        foreach ($errors as $err) {
            $error = $this->manager->getFactory()->make('Error', [$this->manager, $this]);
            $error->parse($err);
            $this->container->set('', $error);
        }
        return $this;
    }