Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Uri.php

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\Psr7

Code

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() === '';
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal