src/JmesPath/TreeCompiler.php
public function visit(array $ast, $fnName, $expr)
    {
        $this->vars = [];
        $this->source = $this->indentation = '';
        $this->write("<?php\n")
            ->write('use DTS\\eBaySDK\\JmesPath\\TreeInterpreter as Ti;')
            ->write('use DTS\\eBaySDK\\JmesPath\\FnDispatcher as Fn;')
            ->write('use DTS\\eBaySDK\\JmesPath\\Utils;')
            ->write('')
            ->write('function %s(Ti $interpreter, $value) {', $fnName)
            ->indent()
                ->dispatch($ast)
                ->write('')
                ->write('return $value;')
            ->outdent()
        ->write('}');

        return $this->source;
    }
public function visit(array $ast, $fnName, $expr)
    {
        $this->vars = [];
        $this->source = $this->indentation = '';
        $this->write("<?php\n")
            ->write('use DTS\\eBaySDK\\JmesPath\\TreeInterpreter as Ti;')
            ->write('use DTS\\eBaySDK\\JmesPath\\FnDispatcher as Fn;')
            ->write('use DTS\\eBaySDK\\JmesPath\\Utils;')
            ->write('')
            ->write('function %s(Ti $interpreter, $value) {', $fnName)
            ->indent()
                ->dispatch($ast)
                ->write('')
                ->write('return $value;')
            ->outdent()
        ->write('}');

        return $this->source;
    }
public function visit ( array $ ast , $ fnName , $ expr ) { $ this -> vars = [ ] ; $ this -> source = $ this -> indentation = '' ; $ this -> write ( "<?php\n" ) -> write ( 'use DTS\\eBaySDK\\JmesPath\\TreeInterpreter as Ti;' ) -> write ( 'use DTS\\eBaySDK\\JmesPath\\FnDispatcher as Fn;' ) -> write ( 'use DTS\\eBaySDK\\JmesPath\\Utils;' ) -> write ( '' ) -> write ( 'function %s(Ti $interpreter, $value) {' , $ fnName ) -> indent ( ) -> dispatch ( $ ast ) -> write ( '' ) -> write ( 'return $value;' ) -> outdent ( ) -> write ( '}' ) ; return $ this -> source ; }
@param array  $ast    AST to compile.
@param string $fnName The name of the function to generate.
@param string $expr   Expression being compiled.

@return string
@param array $ast AST to compile . @param string $fnName The name of the function to generate . @param string $expr Expression being compiled .