/** * @param RequestInterface $request * @param MapInterface<string, AttributeInterface> $attributes * @param UrlInterface $target */ public function resolve(RequestInterface $request, MapInterface $attributes, UrlInterface $target) : UrlInterface { $base = $request->url(); if ($attributes->contains(BaseParser::key())) { $base = $attributes->get(BaseParser::key())->content(); } return Url::fromString($this->resolver->resolve((string) $base, (string) $target)); }
private function merge(MapInterface $http, MapInterface $html) : MapInterface { if (!$http->contains(HttpParser::key())) { return $html; } if (!$html->contains(HtmlParser::key())) { return $http; } return $http->put(self::key(), $http->get(HttpParser::key())->merge($html->get(HtmlParser::key()))); }
private function isImage(MapInterface $attributes) : bool { return $attributes->contains(ContentTypeParser::key()) && (new Image())->isSatisfiedBy($attributes->get(ContentTypeParser::key())->content()); }