/**
  * Returns property namespace name.
  *
  * @return string
  */
 public function getNamespaceName()
 {
     return $this->declaringClass->getNamespaceName();
 }
Esempio n. 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;
 }
 /**
  * @param string $name
  * @param ReflectionClass|ReflectionMethod $reflection
  * @return string
  */
 private function getClassFqn($name, $reflection)
 {
     return Resolver::resolveClassFqn($name, $reflection->getNamespaceAliases(), $reflection->getNamespaceName());
 }