parse() public method

public parse ( ) : AbstractPhpStruct
return gossi\codegen\model\AbstractPhpStruct
Ejemplo n.º 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;
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 4
0
 /**
  * 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);
 }
Ejemplo n.º 5
0
 /**
  * @expectedException phootwork\file\exception\FileNotFoundException
  */
 public function testGetConstantThrowsExceptionWhenConstantDoesNotExist()
 {
     $parser = new FileParser('file-not-found');
     $parser->parse();
 }