コード例 #1
0
 public static function lockFunctionList()
 {
     self::$lock_function_list = true;
 }
コード例 #2
0
 public static function patch($source)
 {
     $patched = false;
     self::$replacement = [];
     $parser = new Parser(new Lexer(['usedAttributes' => ['startTokenPos', 'endTokenPos']]));
     $traverser = new NodeTraverser();
     $traverser->addVisitor(new NodeVisitor());
     $ast_orig = $parser->parse($source);
     $traverser->traverse($ast_orig);
     if (self::$replacement !== []) {
         $patched = true;
         $new_source = self::generateNewSource($source);
     } else {
         $new_source = $source;
     }
     return [$new_source, $patched];
 }