You are here

private function AnnotationReader::getMethodImports in Zircon Profile 8

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

Retrieves imports for methods.

Parameters

\ReflectionMethod $method:

Return value

array

1 call to AnnotationReader::getMethodImports()
AnnotationReader::getMethodAnnotations in vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationReader.php
Gets the annotations applied to a method.

File

vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationReader.php, line 319

Class

AnnotationReader
A reader for docblock annotations.

Namespace

Doctrine\Common\Annotations

Code

private function getMethodImports(ReflectionMethod $method) {
  $class = $method
    ->getDeclaringClass();
  $classImports = $this
    ->getClassImports($class);
  if (!method_exists($class, 'getTraits')) {
    return $classImports;
  }
  $traitImports = array();
  foreach ($class
    ->getTraits() as $trait) {
    if ($trait
      ->hasMethod($method
      ->getName()) && $trait
      ->getFileName() === $method
      ->getFileName()) {
      $traitImports = array_merge($traitImports, $this->phpParser
        ->parseClass($trait));
    }
  }
  return array_merge($classImports, $traitImports);
}