Skip to content

Latest commit

 

History

History
469 lines (183 loc) · 5.71 KB

CachedReader.md

File metadata and controls

469 lines (183 loc) · 5.71 KB

CachedReader

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

Properties

delegate

private \Doctrine\Common\Annotations\Reader $delegate

cache

private \Doctrine\Common\Cache\Cache $cache

debug

private bool $debug

loadedAnnotations

private array<string,object[]> $loadedAnnotations

loadedFilemtimes

private int[] $loadedFilemtimes

Methods

__construct

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

getClassAnnotations

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.


getClassAnnotation

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.


getPropertyAnnotations

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.


getPropertyAnnotation

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.


getMethodAnnotations

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.


getMethodAnnotation

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.


clearLoadedAnnotations

Clears loaded annotations.

public clearLoadedAnnotations(): void

fetchFromCache

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.


saveToCache

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.

isCacheFresh

Checks if the cache is fresh.

private isCacheFresh(string $cacheKey, \ReflectionClass $class): bool

Parameters:

Parameter Type Description
$cacheKey string
$class \ReflectionClass

getLastModification

Returns the time the class was last modified, testing traits and parents

private getLastModification(\ReflectionClass $class): int

Parameters:

Parameter Type Description
$class \ReflectionClass

getTraitLastModificationTime

private getTraitLastModificationTime(\ReflectionClass $reflectionTrait): int

Parameters:

Parameter Type Description
$reflectionTrait \ReflectionClass