public function __construct(string $language, SetInterface $links, int $parsingTime) { if ((string) $links->type() !== UrlInterface::class) { throw new InvalidArgumentException(); } $this->attribute = new Attribute($language, (new RemoveDuplicatedUrls())($links), $parsingTime); }
public function __construct(SetInterface $mask) { if ((string) $mask->type() !== 'string') { throw new InvalidArgumentException(); } $this->mask = $mask; }
public function __construct(SetInterface $toRemove) { if ((string) $toRemove->type() !== 'string') { throw new InvalidArgumentException(); } $this->toRemove = $toRemove; }
public function __construct(SetInterface $extractors) { if ((string) $extractors->type() !== ExtractorInterface::class) { throw new InvalidArgumentException(); } $this->extractors = $extractors; }
public function __construct(string $name, SetInterface $values) { if ((string) $values->type() !== HeaderValueInterface::class) { throw new InvalidArgumentException(); } $this->name = $name; $this->values = $values; }
public function __construct(SetInterface $values) { $values->foreach(function (HeaderValueInterface $value) { if (!$value instanceof AcceptLanguageValue) { throw new InvalidArgumentException(); } }); parent::__construct('Accept-Language', $values); }
public function __construct(string $name, TypeInterface $type, Access $access, SetInterface $variants, bool $optional) { if ((string) $variants->type() !== 'string') { throw new InvalidArgumentException(); } $this->name = $name; $this->type = $type; $this->access = $access; $this->variants = $variants; $this->optional = $optional; }
public function __construct(SetInterface $values) { if ($values->size() === 0) { throw new AcceptHeaderMustContainAtLeastOneValueException(); } $values->foreach(function (HeaderValueInterface $value) { if (!$value instanceof AcceptValue) { throw new InvalidArgumentException(); } }); parent::__construct('Accept', $values); }
public function __construct(string $name, SetInterface $types, int $priority) { if ((string) $types->type() !== MediaType::class || $types->size() === 0) { throw new InvalidArgumentException(); } $this->name = $name; $this->types = $types; $this->priority = $priority; $this->preferredType = $types->sort(function (MediaType $a, MediaType $b) : bool { return $a->priority() < $b->priority(); })->first(); }
public function __construct(SetInterface $values) { if ($values->size() === 0) { throw new CacheControlHeaderMustContainAtLeastOneValueException(); } $values->foreach(function (HeaderValueInterface $header) { if (!$header instanceof CacheControlValueInterface) { throw new InvalidArgumentException(); } }); parent::__construct('Cache-Control', $values); }
protected function parseValues(SetInterface $values) { return $values->current(); }
/** * Make sure the set is compatible with the current one * * @param SetInterface $set * * @throws InvalidArgumentException * * @return void */ private function validate(SetInterface $set) { if (!$set->type()->equals($this->type)) { throw new InvalidArgumentException('The 2 sets does not reference the same type'); } }
protected function parseValues(SetInterface $values) { return Url::fromString($values->current()); }