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