/**
  * @return array {[ className => ReflectionMethod[] ]}
  */
 public function getInheritedMethods()
 {
     $methods = [];
     $allMethods = array_flip(array_map(function (ReflectionMethod $method) {
         return $method->getName();
     }, $this->reflectionClass->getOwnMethods()));
     foreach ($this->getParentClassesAndInterfaces() as $class) {
         $inheritedMethods = [];
         foreach ($class->getOwnMethods() as $method) {
             if (!array_key_exists($method->getName(), $allMethods) && !$method->isPrivate()) {
                 $inheritedMethods[$method->getName()] = $method;
                 $allMethods[$method->getName()] = NULL;
             }
         }
         $methods = $this->sortElements($inheritedMethods, $methods, $class);
     }
     return $methods;
 }
Example #2
0
 /**
  * Prepares and returns used class lists.
  *
  * @return array
  */
 protected function parseClassLists()
 {
     $allClasses = array(self::TOKENIZED_CLASSES => array(), self::INTERNAL_CLASSES => array(), self::NONEXISTENT_CLASSES => array());
     $declared = array_flip(array_merge(get_declared_classes(), get_declared_interfaces()));
     foreach ($this->getNamespaces() as $namespace) {
         foreach ($namespace->getClasses() as $name => $trClass) {
             $class = new Reflection\ReflectionClass($trClass, $this->generator);
             $allClasses[self::TOKENIZED_CLASSES][$name] = $class;
             if (!$class->isDocumented()) {
                 continue;
             }
             foreach (array_merge($trClass->getParentClasses(), $trClass->getInterfaces()) as $parentName => $parent) {
                 if ($parent->isInternal()) {
                     if (!isset($allClasses[self::INTERNAL_CLASSES][$parentName])) {
                         $allClasses[self::INTERNAL_CLASSES][$parentName] = $parent;
                     }
                 } elseif (!$parent->isTokenized()) {
                     if (!isset($allClasses[self::NONEXISTENT_CLASSES][$parentName])) {
                         $allClasses[self::NONEXISTENT_CLASSES][$parentName] = $parent;
                     }
                 }
             }
         }
     }
     foreach ($allClasses[self::TOKENIZED_CLASSES] as $class) {
         if (!$class->isDocumented()) {
             continue;
         }
         foreach ($class->getOwnMethods() as $method) {
             $allClasses = $this->processFunction($declared, $allClasses, $method);
         }
         foreach ($class->getOwnProperties() as $property) {
             $annotations = $property->getAnnotations();
             if (!isset($annotations['var'])) {
                 continue;
             }
             foreach ($annotations['var'] as $doc) {
                 foreach (explode('|', preg_replace('~\\s.*~', '', $doc)) as $name) {
                     if ($name = rtrim($name, '[]')) {
                         $name = Resolver::resolveClassFQN($name, $class->getNamespaceAliases(), $class->getNamespaceName());
                         $allClasses = $this->addClass($declared, $allClasses, $name);
                     }
                 }
             }
         }
     }
     foreach ($this->getFunctions() as $function) {
         $allClasses = $this->processFunction($declared, $allClasses, $function);
     }
     array_walk_recursive($allClasses, function (&$reflection, $name, Generator $generator) {
         if (!$reflection instanceof Reflection\ReflectionClass) {
             $reflection = new Reflection\ReflectionClass($reflection, $generator);
         }
     }, $this->generator);
     return $allClasses;
 }