You are here

public static function UriNormalizer::isEquivalent in Lockr 7.3

Whether two URIs can be considered equivalent.

Both URIs are normalized automatically before comparison with the given $normalizations bitmask. The method also accepts relative URI references and returns true when they are equivalent. This of course assumes they will be resolved against the same base URI. If this is not the case, determination of equivalence or difference of relative references does not mean anything.

@link https://tools.ietf.org/html/rfc3986#section-6.1

Parameters

UriInterface $uri1 An URI to compare:

UriInterface $uri2 An URI to compare:

int $normalizations A bitmask of normalizations to apply, see constants:

Return value

bool

File

vendor/guzzlehttp/psr7/src/UriNormalizer.php, line 175

Class

UriNormalizer
Provides methods to normalize and compare URIs.

Namespace

GuzzleHttp\Psr7

Code

public static function isEquivalent(UriInterface $uri1, UriInterface $uri2, $normalizations = self::PRESERVING_NORMALIZATIONS) {
  return (string) self::normalize($uri1, $normalizations) === (string) self::normalize($uri2, $normalizations);
}