/** * @see FWS_Module::run() */ public function run() { $tpl = FWS_Props::get()->tpl(); $input = FWS_Props::get()->input(); $cookies = FWS_Props::get()->cookies(); $file = $input->get_var('file', -1, FWS_Input::STRING); $class = $input->get_var('class', -1, FWS_Input::STRING); $function = $input->get_var('function', -1, FWS_Input::STRING); $url = PC_URL::get_mod_url(); $url->set('file', $file); $url->set('class', $class); $url->set('function', $function); $surl = clone $url; $typecon = new PC_Engine_TypeContainer(new PC_Engine_Options()); $pagination = new PC_Pagination(PC_ENTRIES_PER_PAGE, PC_DAO::get_calls()->get_count_for($file, $class, $function)); $pagination->populate_tpl($url); $start = $pagination->get_start(); $calls = array(); foreach (PC_DAO::get_calls()->get_list($start, PC_ENTRIES_PER_PAGE, $file, $class, $function) as $call) { /* @var $call PC_Obj_Call */ $url = PC_URL::get_mod_url('file'); $url->set('path', $call->get_file()); $url->set('line', $call->get_line()); $url->set_anchor('l' . $call->get_line()); $func = $typecon->get_method_or_func($call->get_class(), $call->get_function()); $calls[] = array('id' => $call->get_id(), 'call' => $this->get_call($call, $typecon), 'file' => $call->get_file(), 'line' => $call->get_line(), 'url' => $url->to_url(), 'since' => $func ? implode(', ', $func->get_version()->get_min()) : '', 'till' => $func ? implode(', ', $func->get_version()->get_max()) : ''); } $callurl = PC_URL::get_mod_url('filepart'); $callurl->set('id', '__ID__'); $callurl->set('type', 'call'); $this->request_formular(); $tpl->add_variables(array('calls' => $calls, 'get_code_url' => $callurl->to_url(), 'file' => $file, 'class' => $class, 'function' => $function, 'search_target' => $surl->to_url(), 'display_search' => $cookies->get_cookie('calls_search') ? 'block' : 'none', 'cookie_name' => $cookies->get_prefix() . 'calls_search')); }
public function run($args) { $project = FWS_Props::get()->project(); $options = new PC_Engine_Options(); $options->add_project($project->get_id()); foreach ($project->get_project_deps() as $pid) { $options->add_project($pid); } $types = new PC_Engine_TypeContainer($options); $storage = new PC_Engine_TypeStorage_DB(); $env = new PC_Engine_Env($options, $types, $storage); $types->prefetch(); $fin = new PC_Engine_TypeFinalizer($env); $fin->finalize(); }
/** * Fetches the page from the specified file and parses it for information about the function */ public function finalize() { $options = new PC_Engine_Options(); $options->add_project(PC_Project::PHPREF_ID); $typecon = new PC_Engine_TypeContainer($options); $typecon->prefetch(); foreach ($this->versions as $vinfo) { list($classname, $funcname, $version) = $vinfo; $class = $typecon->get_class($classname); if ($class !== null) { $func = $class->get_method($funcname); if ($func !== null) { if ($func->get_version()->is_empty()) { $func->get_version()->set($version->get_min(), $version->get_max()); } PC_DAO::get_functions()->update($func, $class->get_id()); } } } // inherit version info to methods, if still empty foreach ($typecon->get_classes() as $c) { $version = $c->get_version(); foreach ($c->get_methods() as $m) { if ($m->get_version()->is_empty()) { $m->get_version()->set($version->get_min(), $version->get_max()); PC_DAO::get_functions()->update($m, $c->get_id()); } } } foreach ($this->aliases as $alias) { list($funcname, $aliasclass, $aliasfunc) = $alias; $aliasf = null; if ($aliasclass) { $class = $typecon->get_class($aliasclass); if ($class !== null) { $aliasf = $class->get_method($aliasfunc); } } else { $aliasf = $typecon->get_function($aliasfunc); } if ($aliasf !== null) { $aliasf->set_name($funcname); PC_DAO::get_functions()->create($aliasf, 0, PC_Project::PHPREF_ID); } } }
/** * Adds all from the given type-container into this one (does not make clones of the objects!) * * @param PC_Engine_TypeContainer $typecon the container */ public function add($typecon) { $this->add_functions($typecon->get_functions()); $this->add_classes($typecon->get_classes()); $this->add_constants($typecon->get_constants()); }