Lines Matching full:base

8  * Resolves a URI reference in the context of a base URI and the opposite way.
56 * Converts the relative URI into a new URI that is resolved against the base URI.
58 * @param UriInterface $base Base URI
65 public static function resolve(UriInterface $base, UriInterface $rel) argument
68 // we can simply return the same base URI instance for this same-document reference
69 return $base;
81 $targetAuthority = $base->getAuthority();
83 $targetPath = $base->getPath();
84 $targetQuery = $rel->getQuery() != '' ? $rel->getQuery() : $base->getQuery();
89 if ($targetAuthority != '' && $base->getPath() === '') {
92 $lastSlashPos = strrpos($base->getPath(), '/');
96 … $targetPath = substr($base->getPath(), 0, $lastSlashPos + 1) . $rel->getPath();
106 $base->getScheme(),
115 * Returns the target URI as a relative reference from the base URI.
119 …* (string) $target === (string) UriResolver::resolve($base, UriResolver::relativize($base, $tar…
121 …* One use-case is to use the current request URI as base URI and then generate relative links in y…
124 * $base = new Uri('http://example.com/a/b/');
125 * echo UriResolver::relativize($base, new Uri('http://example.com/a/b/c')); // prints 'c'.
126 …* echo UriResolver::relativize($base, new Uri('http://example.com/a/x/y')); // prints '../x/y'.
127 * echo UriResolver::relativize($base, new Uri('http://example.com/a/b/?q')); // prints '?q'.
128 …* echo UriResolver::relativize($base, new Uri('http://example.org/a/b/')); // prints '//examp…
133 * echo UriResolver::relativize($base, new Uri('/a/b/c')); // prints 'c' as well
135 * @param UriInterface $base Base URI
140 public static function relativize(UriInterface $base, UriInterface $target) argument
143 …($base->getScheme() !== $target->getScheme() || $target->getAuthority() === '' && $base->getAuthor…
150 … // the target with `$target = self::resolve($base, $target);` and then try make it more relative
155 if ($target->getAuthority() !== '' && $base->getAuthority() !== $target->getAuthority()) {
164 if ($base->getPath() !== $target->getPath()) {
165 return $emptyPathUri->withPath(self::getRelativePath($base, $target));
168 if ($base->getQuery() === $target->getQuery()) {
169 …// Only the target fragment is left. And it must be returned even if base and target fragment are …
173 …// If the base URI has a query but the target has none, we cannot return an empty path reference a…
174 // inherit the base query component when resolving.
185 private static function getRelativePath(UriInterface $base, UriInterface $target) argument
187 $sourceSegments = explode('/', $base->getPath());
207 if ($base->getAuthority() != '' && $base->getPath() === '') {