Inheritance: extends PhpParser\NodeVisitorAbstract
示例#1
0
 /**
  * Creates a PHP interface from file
  *
  * @param string $filename
  * @return PhpInterface
  */
 public static function fromFile($filename)
 {
     $interface = new PhpInterface();
     $parser = new FileParser($filename);
     $parser->addVisitor(new InterfaceParserVisitor($interface));
     $parser->addVisitor(new MethodParserVisitor($interface));
     $parser->addVisitor(new ConstantParserVisitor($interface));
     $parser->parse();
     return $interface;
 }
示例#2
0
 /**
  * Creates a PHP class from file
  *
  * @param string $filename
  * @return PhpClass
  */
 public static function fromFile($filename)
 {
     $class = new PhpClass();
     $parser = new FileParser($filename);
     $parser->addVisitor(new ClassParserVisitor($class));
     $parser->addVisitor(new MethodParserVisitor($class));
     $parser->addVisitor(new ConstantParserVisitor($class));
     $parser->addVisitor(new PropertyParserVisitor($class));
     $parser->parse();
     return $class;
 }
示例#3
0
 /**
  * Creates a PHP trait from a file
  *
  * @param string $filename
  * @return PhpTrait
  */
 public static function fromFile($filename)
 {
     $trait = new PhpTrait();
     $parser = new FileParser($filename);
     $parser->addVisitor(new TraitParserVisitor($trait));
     $parser->addVisitor(new MethodParserVisitor($trait));
     $parser->addVisitor(new ConstantParserVisitor($trait));
     $parser->addVisitor(new PropertyParserVisitor($trait));
     $parser->parse();
     return $trait;
 }
 /**
  * Creates a PHP interface from file 
  * 
  * @param string $filename
  * @return PhpInterface
  */
 public static function fromFile($filename)
 {
     $visitor = new PhpInterfaceVisitor();
     $parser = new FileParser();
     return $parser->parse($visitor, $filename);
 }
 /**
  * @expectedException phootwork\file\exception\FileNotFoundException
  */
 public function testGetConstantThrowsExceptionWhenConstantDoesNotExist()
 {
     $parser = new FileParser('file-not-found');
     $parser->parse();
 }