示例#1
0
 /**
  * @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));
 }
示例#2
0
 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())));
 }
示例#3
0
 private function isImage(MapInterface $attributes) : bool
 {
     return $attributes->contains(ContentTypeParser::key()) && (new Image())->isSatisfiedBy($attributes->get(ContentTypeParser::key())->content());
 }