Esempio n. 1
0
 /**
  * {@inheritdoc}
  */
 public function resolve(Uri $relative)
 {
     if (!$relative instanceof HttpUriInterface || !empty($relative->getScheme())) {
         return $relative->withoutDotSegments();
     }
     if (!empty($relative->getHost())) {
         return $relative->withScheme($this->getScheme())->withoutDotSegments();
     }
     return $this->resolveRelative($relative)->withFragment($relative->getFragment())->withoutDotSegments();
 }
Esempio n. 2
0
 /**
  * Format a URI authority according to the Formatter properties
  *
  * @param Uri $uri
  *
  * @return string
  */
 protected function formatAuthority(Uri $uri)
 {
     if ('' == $uri->getHost()) {
         return '';
     }
     $components = $uri->toArray();
     $port = $components['port'];
     if (!empty($port)) {
         $port = ':' . $port;
     }
     return '//' . $this->uriParser->BuildUserInfo($components['user'], $components['pass']) . $this->formatHost(new Host($components['host'])) . $port;
 }