protected function replaceCachePlaceholders(&$content, $addCacheSegmentMarkersToPlaceholders)
{
$cache = $this->cache;
$foundMissingIdentifier = false;
$content = preg_replace_callback(self::CACHE_PLACEHOLDER_REGEX, function ($match) use($cache, &$foundMissingIdentifier, $addCacheSegmentMarkersToPlaceholders) {
$identifier = $match['identifier'];
$entry = $cache->get($identifier);
if ($entry !== false) {
if ($addCacheSegmentMarkersToPlaceholders) {
return ContentCache::CACHE_SEGMENT_START_TOKEN . $this->randomCacheMarker . $identifier . ContentCache::CACHE_SEGMENT_SEPARATOR_TOKEN . $this->randomCacheMarker . '*' . ContentCache::CACHE_SEGMENT_SEPARATOR_TOKEN . $this->randomCacheMarker . $entry . ContentCache::CACHE_SEGMENT_END_TOKEN . $this->randomCacheMarker;
} else {
return $entry;
}
} else {
$foundMissingIdentifier = true;
return '';
}
}, $content, -1, $count);
if ($foundMissingIdentifier) {
return false;
}
return $count;
}