public function FileCacheReader::getPropertyAnnotations

Get annotations for property

Parameters

\ReflectionProperty $property:

Return value

array

Overrides Reader::getPropertyAnnotations

1 call to FileCacheReader::getPropertyAnnotations()
FileCacheReader::getPropertyAnnotation in drupal/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/FileCacheReader.php
Gets a property annotation.

File

drupal/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/FileCacheReader.php, line 114

Class

FileCacheReader
File cache reader for annotations.

Namespace

Doctrine\Common\Annotations

Code

public function getPropertyAnnotations(\ReflectionProperty $property) {
  $class = $property
    ->getDeclaringClass();
  $key = $class
    ->getName() . '$' . $property
    ->getName();
  if (isset($this->loadedAnnotations[$key])) {
    return $this->loadedAnnotations[$key];
  }
  $path = $this->dir . '/' . strtr($key, '\\', '-') . '.cache.php';
  if (!file_exists($path)) {
    $annot = $this->reader
      ->getPropertyAnnotations($property);
    $this
      ->saveCacheFile($path, $annot);
    return $this->loadedAnnotations[$key] = $annot;
  }
  if ($this->debug && false !== ($filename = $class
    ->getFilename()) && filemtime($path) < filemtime($filename)) {
    unlink($path);
    $annot = $this->reader
      ->getPropertyAnnotations($property);
    $this
      ->saveCacheFile($path, $annot);
    return $this->loadedAnnotations[$key] = $annot;
  }
  return $this->loadedAnnotations[$key] = (include $path);
}