Documentation

PsrCachedReader
in package
implements Reader

A cache aware annotation reader.

Interfaces, Classes, Traits and Enums

Reader
Interface for annotation readers.

Table of Contents

$cache  : CacheItemPoolInterface
$debug  : bool
$delegate  : Reader
$loadedAnnotations  : array<string, array<string|int, object>>
$loadedFilemtimes  : array<string|int, int>
__construct()  : mixed
clearLoadedAnnotations()  : void
getClassAnnotation()  : T|null
Gets a class annotation.
getClassAnnotations()  : array<string|int, object>
Gets the annotations applied to a class.
getMethodAnnotation()  : T|null
Gets a method annotation.
getMethodAnnotations()  : array<string|int, object>
Gets the annotations applied to a method.
getPropertyAnnotation()  : T|null
Gets a property annotation.
getPropertyAnnotations()  : array<string|int, object>
Gets the annotations applied to a property.
fetchFromCache()  : array<string|int, mixed>
getLastModification()  : int
Returns the time the class was last modified, testing traits and parents
getTraitLastModificationTime()  : int
refresh()  : bool
Used in debug mode to check if the cache is fresh.

Properties

$loadedAnnotations

private array<string, array<string|int, object>> $loadedAnnotations = []

$loadedFilemtimes

private array<string|int, int> $loadedFilemtimes = []

Methods

clearLoadedAnnotations()

public clearLoadedAnnotations() : void
Return values
void

getClassAnnotation()

Gets a class annotation.

public getClassAnnotation(ReflectionClass $class, mixed $annotationName) : T|null
Parameters
$class : ReflectionClass

The ReflectionClass of the class from which the class annotations should be read.

$annotationName : mixed

The name of the annotation.

Return values
T|null

The Annotation or NULL, if the requested annotation does not exist.

getClassAnnotations()

Gets the annotations applied to a class.

public getClassAnnotations(ReflectionClass $class) : array<string|int, object>
Parameters
$class : ReflectionClass

The ReflectionClass of the class from which the class annotations should be read.

Return values
array<string|int, object>

An array of Annotations.

getMethodAnnotation()

Gets a method annotation.

public getMethodAnnotation(ReflectionMethod $method, mixed $annotationName) : T|null
Parameters
$method : ReflectionMethod

The ReflectionMethod to read the annotations from.

$annotationName : mixed

The name of the annotation.

Return values
T|null

The Annotation or NULL, if the requested annotation does not exist.

getMethodAnnotations()

Gets the annotations applied to a method.

public getMethodAnnotations(ReflectionMethod $method) : array<string|int, object>
Parameters
$method : ReflectionMethod

The ReflectionMethod of the method from which the annotations should be read.

Return values
array<string|int, object>

An array of Annotations.

getPropertyAnnotation()

Gets a property annotation.

public getPropertyAnnotation(ReflectionProperty $property, mixed $annotationName) : T|null
Parameters
$property : ReflectionProperty

The ReflectionProperty to read the annotations from.

$annotationName : mixed

The name of the annotation.

Return values
T|null

The Annotation or NULL, if the requested annotation does not exist.

getPropertyAnnotations()

Gets the annotations applied to a property.

public getPropertyAnnotations(ReflectionProperty $property) : array<string|int, object>
Parameters
$property : ReflectionProperty

The ReflectionProperty of the property from which the annotations should be read.

Return values
array<string|int, object>

An array of Annotations.

fetchFromCache()

private fetchFromCache(string $cacheKey, ReflectionClass $class, string $method, Reflector $reflector) : array<string|int, mixed>
Parameters
$cacheKey : string
$class : ReflectionClass
$method : string
$reflector : Reflector
Return values
array<string|int, mixed>

getLastModification()

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

private getLastModification(ReflectionClass $class) : int
Parameters
$class : ReflectionClass
Return values
int

getTraitLastModificationTime()

private getTraitLastModificationTime(ReflectionClass $reflectionTrait) : int
Parameters
$reflectionTrait : ReflectionClass
Return values
int

refresh()

Used in debug mode to check if the cache is fresh.

private refresh(string $cacheKey, ReflectionClass $class) : bool
Parameters
$cacheKey : string
$class : ReflectionClass
Return values
bool

Returns true if the cache was fresh, or false if the class being read was modified since writing to the cache.

Search results