public function clean(array $codeLines, $requireSemicolons = false)
    {
        $stmts = $this->parse('<?php ' . \implode(PHP_EOL, $codeLines) . PHP_EOL, $requireSemicolons);
        if ($stmts === false) {
            return false;
        }

        // Catch fatal errors before they happen
        $stmts = $this->traverser->traverse($stmts);

        // Work around https://github.com/nikic/PHP-Parser/issues/399
        $oldLocale = \setlocale(LC_NUMERIC, 0);
        \setlocale(LC_NUMERIC, 'C');

        $code = $this->printer->prettyPrint($stmts);

        // Now put the locale back
        \setlocale(LC_NUMERIC, $oldLocale);

        return $code;
    }
public function clean(array $codeLines, $requireSemicolons = false)
    {
        $stmts = $this->parse('<?php ' . \implode(PHP_EOL, $codeLines) . PHP_EOL, $requireSemicolons);
        if ($stmts === false) {
            return false;
        }

        // Catch fatal errors before they happen
        $stmts = $this->traverser->traverse($stmts);

        // Work around https://github.com/nikic/PHP-Parser/issues/399
        $oldLocale = \setlocale(LC_NUMERIC, 0);
        \setlocale(LC_NUMERIC, 'C');

        $code = $this->printer->prettyPrint($stmts);

        // Now put the locale back
        \setlocale(LC_NUMERIC, $oldLocale);

        return $code;
    }
public function clean ( array $ codeLines , $ requireSemicolons = false ) { $ stmts = $ this -> parse ( '<?php ' . \ implode ( PHP_EOL , $ codeLines ) . PHP_EOL , $ requireSemicolons ) ; if ( $ stmts === false ) { return false ; } // Catch fatal errors before they happen $ stmts = $ this -> traverser -> traverse ( $ stmts ) ; // Work around https://github.com/nikic/PHP-Parser/issues/399 $ oldLocale = \ setlocale ( LC_NUMERIC , 0 ) ; \ setlocale ( LC_NUMERIC , 'C' ) ; $ code = $ this -> printer -> prettyPrint ( $ stmts ) ; // Now put the locale back \ setlocale ( LC_NUMERIC , $ oldLocale ) ; return $ code ; }
Clean the given array of code.

@throws ParseErrorException if the code is invalid PHP, and cannot be coerced into valid PHP

@param array $codeLines
@param bool  $requireSemicolons

@return string|false Cleaned PHP code, False if the input is incomplete
Clean the given array of code .