src/Parser.php
public function parse($code)
    {
        $parser = $this->parserFactory->create($this->parserType);

        try {
            $ast = $parser->parse($code);
        } catch (Error $error) {
            throw new ParseException($error->getMessage(), 0, $error);
        }

        $printer = new Printer($this->securityManager);
        return $printer->prettyPrintFile($ast);
    }
public function parse($code)
    {
        $parser = $this->parserFactory->create($this->parserType);

        try {
            $ast = $parser->parse($code);
        } catch (Error $error) {
            throw new ParseException($error->getMessage(), 0, $error);
        }

        $printer = new Printer($this->securityManager);
        return $printer->prettyPrintFile($ast);
    }
public function parse ( $ code ) { $ parser = $ this -> parserFactory -> create ( $ this -> parserType ) ; try { $ ast = $ parser -> parse ( $ code ) ; } catch ( Error $ error ) { throw new ParseException ( $ error -> getMessage ( ) , 0 , $ error ) ; } $ printer = new Printer ( $ this -> securityManager ) ; return $ printer -> prettyPrintFile ( $ ast ) ; }
Parses untrusted PHP code and returns a secure version which only
contains safe calls. Throws an exception in case the code contains
untrusted calls

@throws \PSX\Sandbox\SecurityException
@throws \PSX\Sandbox\ParseException
@param string $code
@return string
Parses untrusted PHP code and returns a secure version which only contains safe calls . Throws an exception in case the code contains untrusted calls