public function FileCacheReader::getClassAnnotations

Retrieve annotations for class

Parameters

\ReflectionClass $class:

Return value

array

Overrides Reader::getClassAnnotations

1 call to FileCacheReader::getClassAnnotations()
FileCacheReader::getClassAnnotation in drupal/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/FileCacheReader.php
Gets a class annotation.

File

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

Class

FileCacheReader
File cache reader for annotations.

Namespace

Doctrine\Common\Annotations

Code

public function getClassAnnotations(\ReflectionClass $class) {
  $key = $class
    ->getName();
  if (isset($this->loadedAnnotations[$key])) {
    return $this->loadedAnnotations[$key];
  }
  $path = $this->dir . '/' . strtr($key, '\\', '-') . '.cache.php';
  if (!file_exists($path)) {
    $annot = $this->reader
      ->getClassAnnotations($class);
    $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
      ->getClassAnnotations($class);
    $this
      ->saveCacheFile($path, $annot);
    return $this->loadedAnnotations[$key] = $annot;
  }
  return $this->loadedAnnotations[$key] = (include $path);
}