示例#1
0
 /**
  * @param LeagueUriInterface|UriInterface $relative
  *
  * @return LeagueUriInterface|UriInterface
  */
 protected function generate($relative)
 {
     $scheme = $relative->getScheme();
     if (!empty($scheme) && $scheme != $this->uri->getScheme()) {
         return $relative;
     }
     if (!empty($relative->getAuthority())) {
         return $relative->withScheme($this->uri->getScheme());
     }
     return $this->resolveRelative($relative)->withFragment($relative->getFragment());
 }
示例#2
0
文件: Properties.php 项目: BauRo/url
 /**
  * {@inheritdoc}
  */
 public function relativize(Interfaces\Uri $relative)
 {
     if (!$this->scheme->sameValueAs($relative->scheme) || $this->getAuthority() !== $relative->getAuthority()) {
         return $relative;
     }
     return $relative->withScheme('')->withUserInfo('')->withHost('')->withPort('')->withPath($this->path->relativize($relative->path)->__toString());
 }