You are here

private function AnnotationReader::getMethodImports in Plug 7

Retrieves imports for methods.

Parameters

\ReflectionMethod $method:

Return value

array

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

File

lib/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);
}