parse() public method

public parse ( $block, array $aliasMap )
$aliasMap array
Beispiel #1
0
 /**
  * @ covers TheSeer\phpDox\DocBlock\Parser::__construct
  * @ covers TheSeer\phpDox\DocBlock\Parser::parse
  *
  * @dataProvider docblockSources
  */
 public function testParse($src)
 {
     $expected = new fDOMDocument();
     $dir = __DIR__ . '/../../data/docbock/';
     $block = file_get_contents($dir . $src);
     $expected->load($dir . $src . '.xml');
     $factory = new Factory();
     $parser = new Parser($factory);
     $result = $parser->parse($block, array());
     $this->assertInstanceOf('TheSeer\\phpDox\\DocBlock\\DocBlock', $result);
     $dom = new fDOMDocument();
     $dom->appendChild($result->asDom($dom));
     $this->assertEquals($expected->documentElement, $dom->documentElement);
 }
 private function processProperty(\PhpParser\Node\Stmt\Property $node) {
     $property = $node->props[0];
     $member = $this->unit->addMember($property->name);
     $this->setVariableType($member, $property->type);
     $this->setVariableDefaultValue($member, $property->default);
     $visibility = 'public';
     if ($node->isPrivate()) {
         $visibility = 'private';
     } elseif ($node->isProtected()) {
         $visibility = 'protected';
     }
     $member->setVisibility($visibility);
     $docComment = $node->getDocComment();
     if ($docComment !== NULL) {
         $block = $this->dockblocParser->parse($docComment, $this->aliasMap);
         $member->setDocBlock($block);
     }
     $member->setLine($node->getLine());
 }