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