You are here

public function FileCacheReader::getMethodAnnotations in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/FileCacheReader.php \Doctrine\Common\Annotations\FileCacheReader::getMethodAnnotations()

Gets the annotations applied to a method.

Parameters

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

Return value

array An array of Annotations.

Overrides Reader::getMethodAnnotations

1 call to FileCacheReader::getMethodAnnotations()
FileCacheReader::getMethodAnnotation in vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/FileCacheReader.php
Gets a method annotation.

File

vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/FileCacheReader.php, line 165

Class

FileCacheReader
File cache reader for annotations.

Namespace

Doctrine\Common\Annotations

Code

public function getMethodAnnotations(\ReflectionMethod $method) {
  $class = $method
    ->getDeclaringClass();
  if (!isset($this->classNameHashes[$class->name])) {
    $this->classNameHashes[$class->name] = sha1($class->name);
  }
  $key = $this->classNameHashes[$class->name] . '#' . $method
    ->getName();
  if (isset($this->loadedAnnotations[$key])) {
    return $this->loadedAnnotations[$key];
  }
  $path = $this->dir . '/' . strtr($key, '\\', '-') . '.cache.php';
  if (!is_file($path)) {
    $annot = $this->reader
      ->getMethodAnnotations($method);
    $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
      ->getMethodAnnotations($method);
    $this
      ->saveCacheFile($path, $annot);
    return $this->loadedAnnotations[$key] = $annot;
  }
  return $this->loadedAnnotations[$key] = (include $path);
}