public function isInScope(UriInterface $source, UriInterface $comparator): bool
    {
        $source = $this->removeIgnoredComponents($source);
        $comparator = $this->removeIgnoredComponents($comparator);

        $sourceString = (string) $source;
        $comparatorString = (string) $comparator;

        if ($sourceString === $comparatorString) {
            return true;
        }

        if ($this->isSourceUrlSubstringOfComparatorUrl($sourceString, $comparatorString)) {
            return true;
        }

        if (!$this->areSchemesEquivalent($source->getScheme(), $comparator->getScheme())) {
            return false;
        }

        if (!$this->areHostsEquivalent($source->getHost(), $comparator->getHost())) {
            return false;
        }

        return $this->isSourcePathSubstringOfComparatorPath($source->getPath(), $comparator->getPath());
    }
public function isInScope(UriInterface $source, UriInterface $comparator): bool
    {
        $source = $this->removeIgnoredComponents($source);
        $comparator = $this->removeIgnoredComponents($comparator);

        $sourceString = (string) $source;
        $comparatorString = (string) $comparator;

        if ($sourceString === $comparatorString) {
            return true;
        }

        if ($this->isSourceUrlSubstringOfComparatorUrl($sourceString, $comparatorString)) {
            return true;
        }

        if (!$this->areSchemesEquivalent($source->getScheme(), $comparator->getScheme())) {
            return false;
        }

        if (!$this->areHostsEquivalent($source->getHost(), $comparator->getHost())) {
            return false;
        }

        return $this->isSourcePathSubstringOfComparatorPath($source->getPath(), $comparator->getPath());
    }
public function isInScope ( UriInterface $ source , UriInterface $ comparator ) : bool { $ source = $ this -> removeIgnoredComponents ( $ source ) ; $ comparator = $ this -> removeIgnoredComponents ( $ comparator ) ; $ sourceString = ( string ) $ source ; $ comparatorString = ( string ) $ comparator ; if ( $ sourceString === $ comparatorString ) { return true ; } if ( $ this -> isSourceUrlSubstringOfComparatorUrl ( $ sourceString , $ comparatorString ) ) { return true ; } if ( ! $ this -> areSchemesEquivalent ( $ source -> getScheme ( ) , $ comparator -> getScheme ( ) ) ) { return false ; } if ( ! $ this -> areHostsEquivalent ( $ source -> getHost ( ) , $ comparator -> getHost ( ) ) ) { return false ; } return $ this -> isSourcePathSubstringOfComparatorPath ( $ source -> getPath ( ) , $ comparator -> getPath ( ) ) ; }
Is the given comparator url in the scope of the source url?

Comparator is in the same scope as the source if:
- scheme is the same or equivalent (e.g. http and https are equivalent)
- hostname is the same or equivalent (equivalency looks at subdomain equivalence
e.g. example.com and www.example.com)
- path is the same or greater (e.g. sourcepath = /one/two, comparatorpath = /one/two or /one/two/*

Comparison ignores:
- port
- user
- pass
- query
- fragment

@param UriInterface $source
@param UriInterface $comparator

@return bool
Is the given comparator url in the scope of the source url?