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