> */ private $loadedAnnotations = []; /** @var int[] */ private $loadedFilemtimes = []; public function __construct(Reader $reader, CacheItemPoolInterface $cache, bool $debug = false) { $this->delegate = $reader; $this->cache = $cache; $this->debug = (bool) $debug; } /** * {@inheritDoc} */ public function getClassAnnotations(ReflectionClass $class) { $cacheKey = $class->getName(); if (isset($this->loadedAnnotations[$cacheKey])) { return $this->loadedAnnotations[$cacheKey]; } $annots = $this->fetchFromCache($cacheKey, $class, 'getClassAnnotations', $class); return $this->loadedAnnotations[$cacheKey] = $annots; } /** * {@inheritDoc} */ public function getClassAnnotation(ReflectionClass $class, $annotationName) { foreach ($this->getClassAnnotations($class) as $annot) { if ($annot instanceof $annotationName) { return $annot; } } return null; } /** * {@inheritDoc} */ public function getPropertyAnnotations(ReflectionProperty $property) { $class = $property->getDeclaringClass(); $cacheKey = $class->getName() . '$' . $property->getName(); if (isset($this->loadedAnnotations[$cacheKey])) { return $this->loadedAnnotations[$cacheKey]; } $annots = $this->fetchFromCache($cacheKey, $class, 'getPropertyAnnotations', $property); return $this->loadedAnnotations[$cacheKey] = $annots; } /** * {@inheritDoc} */ public function getPropertyAnnotation(ReflectionProperty $property, $annotationName) { foreach ($this->getPropertyAnnotations($property) as $annot) { if ($annot instanceof $annotationName) { return $annot; } } return null; } /** * {@inheritDoc} */ public function getMethodAnnotations(ReflectionMethod $method) { $class = $method->getDeclaringClass(); $cacheKey = $class->getName() . '#' . $method->getName(); if (isset($this->loadedAnnotations[$cacheKey])) { return $this->loadedAnnotations[$cacheKey]; } $annots = $this->fetchFromCache($cacheKey, $class, 'getMethodAnnotations', $method); return $this->loadedAnnotations[$cacheKey] = $annots; } /** * {@inheritDoc} */ public function getMethodAnnotation(ReflectionMethod $method, $annotationName) { foreach ($this->getMethodAnnotations($method) as $annot) { if ($annot instanceof $annotationName) { return $annot; } } return null; } public function clearLoadedAnnotations(): void { $this->loadedAnnotations = []; $this->loadedFilemtimes = []; } /** @return mixed[] */ private function fetchFromCache( string $cacheKey, ReflectionClass $class, string $method, Reflector $reflector ): array { $cacheKey = rawurlencode($cacheKey); $item = $this->cache->getItem($cacheKey); if (($this->debug && ! $this->refresh($cacheKey, $class)) || ! $item->isHit()) { $this->cache->save($item->set($this->delegate->{$method}($reflector))); } return $item->get(); } /** * Used in debug mode to check if the cache is fresh. * * @return bool Returns true if the cache was fresh, or false if the class * being read was modified since writing to the cache. */ private function refresh(string $cacheKey, ReflectionClass $class): bool { $lastModification = $this->getLastModification($class); if ($lastModification === 0) { return true; } $item = $this->cache->getItem('[C]' . $cacheKey); if ($item->isHit() && $item->get() >= $lastModification) { return true; } $this->cache->save($item->set(time())); return false; } /** * Returns the time the class was last modified, testing traits and parents */ private function getLastModification(ReflectionClass $class): int { $filename = $class->getFileName(); if (isset($this->loadedFilemtimes[$filename])) { return $this->loadedFilemtimes[$filename]; } $parent = $class->getParentClass(); $lastModification = max(array_merge( [$filename ? filemtime($filename) : 0], array_map(function (ReflectionClass $reflectionTrait): int { return $this->getTraitLastModificationTime($reflectionTrait); }, $class->getTraits()), array_map(function (ReflectionClass $class): int { return $this->getLastModification($class); }, $class->getInterfaces()), $parent ? [$this->getLastModification($parent)] : [] )); assert($lastModification !== false); return $this->loadedFilemtimes[$filename] = $lastModification; } private function getTraitLastModificationTime(ReflectionClass $reflectionTrait): int { $fileName = $reflectionTrait->getFileName(); if (isset($this->loadedFilemtimes[$fileName])) { return $this->loadedFilemtimes[$fileName]; } $lastModificationTime = max(array_merge( [$fileName ? filemtime($fileName) : 0], array_map(function (ReflectionClass $reflectionTrait): int { return $this->getTraitLastModificationTime($reflectionTrait); }, $reflectionTrait->getTraits()) )); assert($lastModificationTime !== false); return $this->loadedFilemtimes[$fileName] = $lastModificationTime; } } __halt_compiler();----SIGNATURE:----sgK7hTgT42bwE/1VLwSLvRfbcUFahSsb1VS6bS9fdaKhuNDb3te5L4uVwplrQ4XeafkjIR8Fnb5Tjyw4EDQHTzakKsNfUgh32gTqd2Tng1IQIk2HHqvLJJaXKSwcjToyDlB/os0ly4PWT2IDa8JGL6PSiAfvFO7juwZhhOKpLcsPvdGORzSDqsVMoRxha6Tj2X9Sub9jd6RAJliyXqr395vCrCrkGcLG5dpCHwzggt/Hr4fq4RjUF6PaX7y5wSqYZ+R97O024WdF8Tm49DS8cGlEInclYrgqDPS32ZJuQqMqV+nNkIvi9GPbC8ruI312Dr79ylUZlCcvgef1mO/n19CQLrDx6OhGq2fgOHWADTihJw/w6KBO3/qkLWbRYaz49FrpMxksJ2N4eOotfAKZzBkNGTYD6Jzen2B6NCkwuf2GwZczSHW8pJoPHDdwBVjJ9W2l1ND3YCkG/0JQfl9NsfF19RxkoKZeXnWfnFZAZRzsoy0BtFCo26gg52do2O0VvhV61THho4e/+BbsjTSXz1+WT+nvYSB3iruZw+/JcJ2itZInKOwX9GGE8mdZQtzD1RW0dWSQDdXVgHo6ko6P87mMEOAk0um337YAvsb4x0xUQFOahiodnYLt2lAKC1vELFQeglroLdzyG11NTi2eDJGqdRpXi6aSOW0dPG3XkX0=----ATTACHMENT:----NjYxMjE0MDQ1MjA3MDcyOSA1OTM2NTg4NjE4ODg2NTc0IDYxMjA4NDk0ODU5NDQ1MDY=