function Uri::isSameDocumentReference
Whether the URI is a same-document reference.
A same-document reference refers to a URI that is, aside from its fragment component, identical to the base URI. When no base URI is given, only an empty URI reference (apart from its fragment) is considered a same-document reference.
Parameters
UriInterface $uri The URI to check:
UriInterface|null $base An optional base URI to compare against:
See also
https://datatracker.ietf.org/doc/html/rfc3986#section-4.4
File
-
vendor/
guzzlehttp/ psr7/ src/ Uri.php, line 282
Class
- Uri
- PSR-7 URI implementation.
Namespace
GuzzleHttp\Psr7Code
public static function isSameDocumentReference(UriInterface $uri, ?UriInterface $base = null) : bool {
if ($base !== null) {
$uri = UriResolver::resolve($base, $uri);
return $uri->getScheme() === $base->getScheme() && $uri->getAuthority() === $base->getAuthority() && $uri->getPath() === $base->getPath() && $uri->getQuery() === $base->getQuery();
}
return $uri->getScheme() === '' && $uri->getAuthority() === '' && $uri->getPath() === '' && $uri->getQuery() === '';
}