You are here

public function FileCacheReader::getPropertyAnnotations in Service Container 7

Same name and namespace in other branches
  1. 7.2 modules/providers/service_container_annotation_discovery/lib/Doctrine/annotations/lib/Doctrine/Common/Annotations/FileCacheReader.php \Doctrine\Common\Annotations\FileCacheReader::getPropertyAnnotations()

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 FileCacheReader::getPropertyAnnotations()
FileCacheReader::getPropertyAnnotation in modules/providers/service_container_annotation_discovery/lib/Doctrine/annotations/lib/Doctrine/Common/Annotations/FileCacheReader.php
Gets a property annotation.

File

modules/providers/service_container_annotation_discovery/lib/Doctrine/annotations/lib/Doctrine/Common/Annotations/FileCacheReader.php, line 112

Class

FileCacheReader
File cache reader for annotations.

Namespace

Doctrine\Common\Annotations

Code

public function getPropertyAnnotations(\ReflectionProperty $property) {
  $class = $property
    ->getDeclaringClass();
  if (!isset($this->classNameHashes[$class->name])) {
    $this->classNameHashes[$class->name] = sha1($class->name);
  }
  $key = $this->classNameHashes[$class->name] . '$' . $property
    ->getName();
  if (isset($this->loadedAnnotations[$key])) {
    return $this->loadedAnnotations[$key];
  }
  $path = $this->dir . '/' . strtr($key, '\\', '-') . '.cache.php';
  if (!is_file($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);
}