Lexy::check_syntax PHP Méthode

check_syntax() protected méthode

[check_syntax description]
protected check_syntax ( [type] $code ) : [type]
$code [type]
Résultat [type]
    protected function check_syntax($code)
    {
        $errors = array();
        ob_start();
        $check = function_exists('eval') ? eval('?>' . '<?php if(0): ?>' . $code . '<?php endif; ?><?php ') : true;
        if ($check === false) {
            $output = ob_get_clean();
            $output = strip_tags($output);
            if (preg_match_all("/on line (\\d+)/m", $output, $matches)) {
                foreach ($matches[1] as $m) {
                    $errors[] = "Parse error on line: " . $m;
                }
            } else {
                $errors[] = 'syntax error';
            }
        } else {
            ob_end_clean();
        }
        return count($errors) ? $errors : false;
    }