/**
  * Returns the file name the property is defined in.
  *
  * @return string
  */
 public function getFileName()
 {
     return $this->declaringClass->getFileName();
 }
 /**
  * Returns a link to class summary file.
  *
  * @param string|\ApiGen\ReflectionClass $class Class reflection or name
  *
  * @return string
  */
 public function getClassUrl($class)
 {
     $className = $class instanceof ReflectionClass ? $class->getName() : $class;
     return sprintf($this->config->template['templates']['main']['class']['filename'], $this->urlize($className));
 }
 /**
  * Returns a link to property in class summary file.
  *
  * @param \ApiGen\ReflectionProperty $property Property reflection
  * @param \ApiGen\ReflectionClass    $class    Property declaring class
  *
  * @return string
  */
 public function getPropertyUrl(ReflectionProperty $property, ReflectionClass $class = null)
 {
     $className = null !== $class ? $class->getName() : $property->getDeclaringClassName();
     return $this->getClassUrl($className) . '#' . ($property->isMagic() ? 'm' : '') . '$' . $property->getName();
 }
Beispiel #4
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 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;
                     }
                 }
             }
             $this->generator->checkMemory();
         }
     }
     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);
                     }
                 }
             }
         }
         $this->generator->checkMemory();
     }
     foreach ($this->getFunctions() as $function) {
         $allClasses = $this->processFunction($declared, $allClasses, $function);
     }
     array_walk_recursive($allClasses, function (&$reflection, $name, Generator $generator) {
         if (!$reflection instanceof ReflectionClass) {
             $reflection = new ReflectionClass($reflection, $generator);
         }
     }, $this->generator);
     return $allClasses;
 }