/** * {@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(); }
/** * 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; }