コード例 #1
0
ファイル: ClassParser.php プロジェクト: nevernet/padawan.php
 public function parse(Class_ $node, Entity\FQN $fqn, $file)
 {
     $fqcn = new Entity\FQCN($node->name, $fqn);
     $classData = new Node\ClassData($fqcn, $file);
     if ($node->extends instanceof Name) {
         $classData->setParent($this->useParser->getFQCN($node->extends));
     }
     foreach ($node->implements as $interfaceName) {
         $classData->addInterface($this->useParser->getFQCN($interfaceName));
     }
     $classData->startLine = $node->getAttribute("startLine");
     $this->parseDocComments($classData, $node->getAttribute("comments"));
     foreach ($node->stmts as $child) {
         if ($child instanceof ClassMethod) {
             $classData->addMethod($this->parseMethod($child));
         } elseif ($child instanceof Property) {
             foreach ($child->props as $prop) {
                 $classData->addProp($this->parseProperty($prop, $child->type, $child->getAttribute('comments')));
             }
         } elseif ($child instanceof ClassConst) {
             foreach ($child->consts as $const) {
                 $classData->addConst($const->name);
             }
         }
     }
     return $classData;
 }
コード例 #2
0
function createClass($classFQN, $fqcn)
{
    $class = new ClassData($classFQN, 'dummy/path/class.php');
    $method = new MethodData('method2');
    $method->setType(ClassData::MODIFIER_PUBLIC);
    $param = new ClassProperty('param2');
    $param->type = $fqcn;
    $method->setReturn($fqcn);
    $class->addMethod($method);
    $class->addProp($param);
    return $class;
}
コード例 #3
0
ファイル: Index.php プロジェクト: nevernet/padawan.php
 protected function addExtend(ClassData $class, FQCN $parent)
 {
     $this->findClassChildren($parent);
     $this->extends[$parent->toString()][$class->fqcn->toString()] = $class;
     $parentClass = $this->findClassByFQCN($parent);
     if ($parentClass instanceof ClassData) {
         $class->setParent($parentClass);
     }
 }