Exemple #1
0
 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);
         }
     }
 }