/** * @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()); }
/** * Format an Uri according to the Formatter properties * * @param Uri|UriInterface $uri * * @return string */ protected function formatUri($uri) { $scheme = $uri->getScheme(); if ('' !== $scheme) { $scheme .= ':'; } $auth = $this->formatAuthority($uri); return $scheme . $auth . $this->formatPath($uri->getPath(), $auth) . $this->formatQuery($uri) . $this->formatFragment($uri); }
/** * Format a Interfaces\Schemes\Uri according to the Formatter properties * * @param Uri|UriInterface $uri * * @return string */ protected function formatUri($uri) { $scheme = $uri->getScheme(); if (!empty($scheme)) { $scheme .= ':'; } $auth = $this->formatAuthority($uri); $query = $this->formatUriPart(new Query($uri->getQuery())); if (!empty($query)) { $query = '?' . $query; } $fragment = $uri->getFragment(); if (!empty($fragment)) { $fragment = '#' . $fragment; } return $scheme . $auth . $this->formatPath($uri->getPath(), !empty($auth)) . $query . $fragment; }