private function createScope($src)
 {
     $lexer = new \PHPParser_Lexer('<?php class Foo { public function foo($param1, $param2) { ' . $src . ' } }');
     $parser = new \PHPParser_Parser();
     $ast = $parser->parse($lexer);
     $traverser = new \PHPParser_NodeTraverser();
     $traverser->addVisitor(new \PHPParser_NodeVisitor_NameResolver());
     $traverser->addVisitor(new NormalizingNodeVisitor());
     $ast = $traverser->traverse($ast);
     $traverser = new \PHPParser_NodeTraverser();
     $traverser->addVisitor(new \PHPParser_NodeVisitor_NodeConnector());
     $traverser->traverse($ast);
     $rootNode = $ast[0];
     $scopeRoot = $ast[0]->stmts[0];
     $sc = new SyntacticScopeCreator();
     return $sc->createScope($scopeRoot, new Scope($rootNode));
 }
 private function computeLiveness($src)
 {
     $src = '<?php class Foo { public function foo($param1, $param2) { ' . $src . ' } }';
     $parser = new \PHPParser_Parser();
     $lexer = new \PHPParser_Lexer($src);
     $ast = $parser->parse($lexer);
     $traverser = new \PHPParser_NodeTraverser();
     $traverser->addVisitor(new \PHPParser_NodeVisitor_NameResolver());
     $traverser->addVisitor(new NormalizingNodeVisitor());
     $ast = $traverser->traverse($ast);
     $traverser = new \PHPParser_NodeTraverser();
     $traverser->addVisitor(new \PHPParser_NodeVisitor_NodeConnector());
     $traverser->traverse($ast);
     $scopeCreator = new SyntacticScopeCreator();
     $scope = $scopeCreator->createScope($ast[0]->stmts[0], new Scope($ast[0]));
     $cfa = new ControlFlowAnalysis();
     $cfa->process($ast[0]->stmts[0]);
     $cfg = $cfa->getGraph();
     $lva = new LiveVariablesAnalysis($cfg, $scope);
     $lva->analyze();
     return $lva;
 }