src/Hydrator/Generated/Generator.php
protected function generateAst($realClass, $hydratorClass)
    {
        $originalClass = new \ReflectionClass($realClass);
        $builder = new ClassBuilder;
        $traverser = new NodeTraverser;

        $ast = $builder->fromReflection($originalClass);

        // Remove unused methods
        $traverser->addVisitor(new MethodDisablerVisitor(function() { return false; }));

        // Implement new methods and interfaces, extend original class
        $this->addMethodVisitors($originalClass, $traverser);
        $traverser->addVisitor(new ClassExtensionVisitor($realClass, $realClass));
        $traverser->addVisitor(new ClassImplementorVisitor($realClass, ['Indigo\\Hydra\\Hydrator']));

        // Renames class
        $traverser->addVisitor(new ClassRenamerVisitor($originalClass, $hydratorClass));

        return $traverser->traverse($ast);
    }
protected function generateAst($realClass, $hydratorClass)
    {
        $originalClass = new \ReflectionClass($realClass);
        $builder = new ClassBuilder;
        $traverser = new NodeTraverser;

        $ast = $builder->fromReflection($originalClass);

        // Remove unused methods
        $traverser->addVisitor(new MethodDisablerVisitor(function() { return false; }));

        // Implement new methods and interfaces, extend original class
        $this->addMethodVisitors($originalClass, $traverser);
        $traverser->addVisitor(new ClassExtensionVisitor($realClass, $realClass));
        $traverser->addVisitor(new ClassImplementorVisitor($realClass, ['Indigo\\Hydra\\Hydrator']));

        // Renames class
        $traverser->addVisitor(new ClassRenamerVisitor($originalClass, $hydratorClass));

        return $traverser->traverse($ast);
    }
protected function generateAst ( $ realClass , $ hydratorClass ) { $ originalClass = new \ ReflectionClass ( $ realClass ) ; $ builder = new ClassBuilder ; $ traverser = new NodeTraverser ; $ ast = $ builder -> fromReflection ( $ originalClass ) ; // Remove unused methods $ traverser -> addVisitor ( new MethodDisablerVisitor ( function ( ) { return false ; } ) ) ; // Implement new methods and interfaces, extend original class $ this -> addMethodVisitors ( $ originalClass , $ traverser ) ; $ traverser -> addVisitor ( new ClassExtensionVisitor ( $ realClass , $ realClass ) ) ; $ traverser -> addVisitor ( new ClassImplementorVisitor ( $ realClass , [ 'Indigo\\Hydra\\Hydrator' ] ) ) ; // Renames class $ traverser -> addVisitor ( new ClassRenamerVisitor ( $ originalClass , $ hydratorClass ) ) ; return $ traverser -> traverse ( $ ast ) ; }
Generates an AST out of a given reflection class and a target hydrator name

@param string $realClass
@param string $hydratorClass

@return \PhpParser\Node[]
Generates an AST out of a given reflection class and a target hydrator name