示例#1
0
 /**
  * @param \Reflector $reflection
  * @param string $type
  *   If we are not reflecting the class itself, specify "Method", "Property", etc.
  *
  * @return array
  */
 public static function getCodeDocs($reflection, $type = NULL)
 {
     $docs = self::parseDocBlock($reflection->getDocComment());
     // Recurse into parent functions
     if (isset($docs['inheritDoc'])) {
         unset($docs['inheritDoc']);
         $newReflection = NULL;
         try {
             if ($type) {
                 $name = $reflection->getName();
                 $reflectionClass = $reflection->getDeclaringClass()->getParentClass();
                 if ($reflectionClass) {
                     $getItem = "get{$type}";
                     $newReflection = $reflectionClass->{$getItem}($name);
                 }
             } else {
                 $newReflection = $reflection->getParentClass();
             }
         } catch (\ReflectionException $e) {
         }
         if ($newReflection) {
             // Mix in
             $additionalDocs = self::getCodeDocs($newReflection, $type);
             if (!empty($docs['comment']) && !empty($additionalDocs['comment'])) {
                 $docs['comment'] .= "\n\n" . $additionalDocs['comment'];
             }
             $docs += $additionalDocs;
         }
     }
     return $docs;
 }
示例#2
0
 /**
  *
  * @return array
  */
 public function heritedMethods()
 {
     if (!$this->reflector instanceof Reflection\ReflectionClass) {
         return array();
     }
     $parent = $this->reflector->getParentClass();
     if (empty($parent)) {
         return array();
     }
     $methods = array();
     $this->getParentMethods($parent, $methods);
     return $methods;
 }
示例#3
0
function annotateParent(\Reflector $refl)
{
    $parent = $refl->getParentClass();
    if ($parent) {
        return array('parent' => $parent->name);
    } else {
        return array();
    }
}