You are here

public function CachedReader::getPropertyAnnotations in Plug 7

Gets the annotations applied to a property.

Parameters

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

Return value

array An array of Annotations.

Overrides Reader::getPropertyAnnotations

1 call to CachedReader::getPropertyAnnotations()
CachedReader::getPropertyAnnotation in lib/doctrine/annotations/lib/Doctrine/Common/Annotations/CachedReader.php
Gets a property annotation.

File

lib/doctrine/annotations/lib/Doctrine/Common/Annotations/CachedReader.php, line 107

Class

CachedReader
A cache aware annotation reader.

Namespace

Doctrine\Common\Annotations

Code

public function getPropertyAnnotations(\ReflectionProperty $property) {
  $class = $property
    ->getDeclaringClass();
  $cacheKey = $class
    ->getName() . '$' . $property
    ->getName();
  if (isset($this->loadedAnnotations[$cacheKey])) {
    return $this->loadedAnnotations[$cacheKey];
  }
  if (false === ($annots = $this
    ->fetchFromCache($cacheKey, $class))) {
    $annots = $this->delegate
      ->getPropertyAnnotations($property);
    $this
      ->saveToCache($cacheKey, $annots);
  }
  return $this->loadedAnnotations[$cacheKey] = $annots;
}