DmitryDulepov\Realurl\Decoder\UrlDecoder::decodePathByOverride PHP Method

decodePathByOverride() protected method

Tries to decode the path by path override when the whole path is overriden.
protected decodePathByOverride ( array &$pathSegments ) : DmitryDulepov\Realurl\Cache\PathCacheEntry
$pathSegments array
return DmitryDulepov\Realurl\Cache\PathCacheEntry
    protected function decodePathByOverride(array &$pathSegments)
    {
        $result = null;
        $possibleSegments = array();
        foreach ($pathSegments as $segment) {
            if ($this->isPostVar($segment)) {
                break;
            }
            $possibleSegments[] = $segment;
        }
        while (!empty($possibleSegments) && !$result) {
            $result = $this->searchPagesByPathOverride($possibleSegments);
            if (!$result) {
                array_pop($possibleSegments);
            }
        }
        if ($result) {
            $pathSegments = array_slice($pathSegments, count($possibleSegments));
        }
        return $result;
    }