parseAndWalk($entrypoint_path, null); //echo $this->nodeDumper->dump($entrypoint_ast); $magics=array('__FILE__' => $entrypoint_path); $fw_props=$this->staticEvalDefine($entrypoint_ast, $magics); if (!is_array($fw_props)) throw new Exception("No properties found in '$entrypoint_path'"); // print_r($fw_props); $required=array('ROOT','APP_DIR','CAKE_CORE_INCLUDE_PATH','WEBROOT_DIR', 'WWW_ROOT'); $missing=array_diff($required, array_keys($fw_props)); // print_r($missing); assert('count($missing)===0;'); return array_merge(array('entrypoint_path' => $entrypoint_path), $fw_props); } public function parseFrameworkConfig($fw_props) { return array(); } public function parseFrameworkCode($fw_props, $fw_conf, $cache_path) { $filelist=$this->findAllFiles($fw_props['CAKE_CORE_INCLUDE_PATH'], '/(\.php|\.ctp)$/', '/^\.svn$/'); //print_r($filelist); $env=$fw_props; //TODO : More things here ? foreach ($filelist as $f) { //TODO : cache match $cache_filepath=$cache_path . "/" . sha1($f) . "-" . substr(sha1(print_r($env,true)),-8,8) . ".ast"; $ast=$this->parseAndWalk($f, null, $env); $this->serializeAST($ast, $f, $cache_filepath); } } public function parseApplicationCode($fw_props, $fw_conf, $fw_extra, $cache_path) { } public function computePageList($fw_props, $fw_conf, $fw_extra, $app_extra) { return array( 'page1' => array(), 'page2' => array(), ); } public function outputMappingFile($app_pages, $result_path) { } public function makePageFullAST($page, $page_props, $fw_props, $fw_conf, $fw_extra, $app_extra, $cache_path) { } public function analysePageAST($page_full_ast, $page, $page_props, $fw_props, $fw_conf, $fw_extra, $app_extra, $cache_path) { } public function throwDeadCode(&$page_annotated_ast) { } public function weaveCode($page_annotated_ast) { return array(new PHPParser_Node_Stmt_Echo(array(new PHPParser_Node_Scalar_String("Hello World\n")))); } } ?>