/**
  * @return string
  */
 private function getFunctionFqnName(ReflectionFunction $reflection)
 {
     return $reflection->getNamespaceName() . '\\' . $reflection->getName();
 }
예제 #2
0
파일: Generator.php 프로젝트: sirone/apigen
 /**
  * Sorts functions by FQN.
  *
  * @param \ApiGen\Reflection\ReflectionFunction $one
  * @param \ApiGen\Reflection\ReflectionFunction $two
  * @return integer
  */
 private function sortFunctions(Reflection\ReflectionFunction $one, Reflection\ReflectionFunction $two)
 {
     return strcasecmp($one->getNamespaceName() . '\\' . $one->getName(), $two->getNamespaceName() . '\\' . $two->getName());
 }
예제 #3
0
 /**
  * Processes a function/method and adds classes from annotations to the overall class array.
  *
  * @param array $declared Array of declared classes
  * @param array $allClasses Array with all classes parsed so far
  * @param \ApiGen\Reflection\ReflectionFunction|\TokenReflection\IReflectionFunctionBase $function Function/method reflection
  * @return array
  */
 private function processFunction(array $declared, array $allClasses, $function)
 {
     static $parsedAnnotations = array('param', 'return', 'throws');
     $annotations = $function->getAnnotations();
     foreach ($parsedAnnotations as $annotation) {
         if (!isset($annotations[$annotation])) {
             continue;
         }
         foreach ($annotations[$annotation] as $doc) {
             foreach (explode('|', preg_replace('~\\s.*~', '', $doc)) as $name) {
                 if ($name) {
                     $name = Resolver::resolveClassFQN(rtrim($name, '[]'), $function->getNamespaceAliases(), $function->getNamespaceName());
                     $allClasses = $this->addClass($declared, $allClasses, $name);
                 }
             }
         }
     }
     foreach ($function->getParameters() as $param) {
         if ($hint = $param->getClassName()) {
             $allClasses = $this->addClass($declared, $allClasses, $hint);
         }
     }
     return $allClasses;
 }