A cache aware annotation reader.
- Full name:
\Doctrine\Common\Annotations\CachedReader
- This class is marked as final and can't be subclassed
- Warning: this class is deprecated. This means that this class will likely be removed in a future version.
- This class implements:
\Doctrine\Common\Annotations\Reader
- This class is a Final class
private \Doctrine\Common\Annotations\Reader $delegate
private \Doctrine\Common\Cache\Cache $cache
private bool $debug
private array<string,object[]> $loadedAnnotations
private int[] $loadedFilemtimes
public __construct(\Doctrine\Common\Annotations\Reader $reader, \Doctrine\Common\Cache\Cache $cache, bool $debug = false): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$reader |
\Doctrine\Common\Annotations\Reader | |
$cache |
\Doctrine\Common\Cache\Cache | |
$debug |
bool |
Gets the annotations applied to a class.
public getClassAnnotations(\ReflectionClass $class): object[]
Parameters:
Parameter | Type | Description |
---|---|---|
$class |
\ReflectionClass | The ReflectionClass of the class from which the class annotations should be read. |
Return Value:
An array of Annotations.
Gets a class annotation.
public getClassAnnotation(\ReflectionClass $class, mixed $annotationName): \Doctrine\Common\Annotations\T|null
Parameters:
Parameter | Type | Description |
---|---|---|
$class |
\ReflectionClass | The ReflectionClass of the class from which the class annotations should be read. |
$annotationName |
mixed | The name of the annotation. |
Return Value:
The Annotation or NULL, if the requested annotation does not exist.
Gets the annotations applied to a property.
public getPropertyAnnotations(\ReflectionProperty $property): object[]
Parameters:
Parameter | Type | Description |
---|---|---|
$property |
\ReflectionProperty | The ReflectionProperty of the property from which the annotations should be read. |
Return Value:
An array of Annotations.
Gets a property annotation.
public getPropertyAnnotation(\ReflectionProperty $property, mixed $annotationName): \Doctrine\Common\Annotations\T|null
Parameters:
Parameter | Type | Description |
---|---|---|
$property |
\ReflectionProperty | The ReflectionProperty to read the annotations from. |
$annotationName |
mixed | The name of the annotation. |
Return Value:
The Annotation or NULL, if the requested annotation does not exist.
Gets the annotations applied to a method.
public getMethodAnnotations(\ReflectionMethod $method): object[]
Parameters:
Parameter | Type | Description |
---|---|---|
$method |
\ReflectionMethod | The ReflectionMethod of the method from which the annotations should be read. |
Return Value:
An array of Annotations.
Gets a method annotation.
public getMethodAnnotation(\ReflectionMethod $method, mixed $annotationName): \Doctrine\Common\Annotations\T|null
Parameters:
Parameter | Type | Description |
---|---|---|
$method |
\ReflectionMethod | The ReflectionMethod to read the annotations from. |
$annotationName |
mixed | The name of the annotation. |
Return Value:
The Annotation or NULL, if the requested annotation does not exist.
Clears loaded annotations.
public clearLoadedAnnotations(): void
Fetches a value from the cache.
private fetchFromCache(string $cacheKey, \ReflectionClass $class): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$cacheKey |
string | The cache key. |
$class |
\ReflectionClass |
Return Value:
The cached value or false when the value is not in cache.
Saves a value to the cache.
private saveToCache(string $cacheKey, mixed $value): void
Parameters:
Parameter | Type | Description |
---|---|---|
$cacheKey |
string | The cache key. |
$value |
mixed | The value. |
Checks if the cache is fresh.
private isCacheFresh(string $cacheKey, \ReflectionClass $class): bool
Parameters:
Parameter | Type | Description |
---|---|---|
$cacheKey |
string | |
$class |
\ReflectionClass |
Returns the time the class was last modified, testing traits and parents
private getLastModification(\ReflectionClass $class): int
Parameters:
Parameter | Type | Description |
---|---|---|
$class |
\ReflectionClass |
private getTraitLastModificationTime(\ReflectionClass $reflectionTrait): int
Parameters:
Parameter | Type | Description |
---|---|---|
$reflectionTrait |
\ReflectionClass |