DmitryDulepov\Realurl\Decoder\UrlDecoder::searchPathInCache PHP Метод

searchPathInCache() защищенный Метод

Fetches the entry from the RealURL path cache. This would start stripping segments if the entry is not found until none is left. Effectively it is a search for the largest caching path for those segments.
protected searchPathInCache ( array &$pathSegments ) : DmitryDulepov\Realurl\Cache\PathCacheEntry | null
$pathSegments array
Результат DmitryDulepov\Realurl\Cache\PathCacheEntry | null
    protected function searchPathInCache(array &$pathSegments)
    {
        $result = NULL;
        /** @var PathCacheEntry $result */
        $removedSegments = array();
        do {
            $path = implode('/', $pathSegments);
            // Since we know nothing about mount point at this stage, we exclude it from search by passing null as the second argument
            $cacheEntry = $this->cache->getPathFromCacheByPagePath($this->rootPageId, $this->detectedLanguageId, null, $path);
            if ($cacheEntry) {
                if ((int) $cacheEntry->getExpiration() !== 0) {
                    $this->isExpiredPath = TRUE;
                    $nonExpiredCacheEntry = $this->cache->getPathFromCacheByPageId($cacheEntry->getRootPageId(), $cacheEntry->getLanguageId(), $cacheEntry->getPageId(), $cacheEntry->getMountPoint());
                    if ($nonExpiredCacheEntry) {
                        $this->expiredPath = $cacheEntry->getPagePath();
                        $cacheEntry = $nonExpiredCacheEntry;
                    }
                }
                $result = $cacheEntry;
            } else {
                if (count($pathSegments) > 0) {
                    array_unshift($removedSegments, array_pop($pathSegments));
                }
            }
        } while (is_null($result) && count($pathSegments) > 0);
        $pathSegments = $removedSegments;
        return $result;
    }