Esempio n. 1
0
 function uses_make()
 {
     $root = $this->root;
     $package = $this->package;
     preg_match_all('/\\$([a-zA-Z][a-zA-Z0-9]+)(?:[._]([a-zA-Z0-9]+))?(?![a-zA-Z0-9$])/', $this->file->content, $matches, PREG_SET_ORDER);
     $uses = array();
     $mainModule = $package[$package->name];
     if ($mainModule->exists) {
         $uses += $mainModule->modules->list;
     }
     if ($matches) {
         foreach ($matches as $item) {
             list($str, $packName) = $item;
             $moduleName = so_value::make($item[2]);
             if (!$moduleName) {
                 $moduleName = $packName;
             }
             $module = $root[$packName][$moduleName];
             if ($module === $this->module) {
                 continue;
             }
             if (!$module->exists) {
                 throw new \Exception("Module [{$module->dir}] not found for [{$this->file}]");
             }
             $uses += $module->modules->list;
         }
     }
     $uses += $this->module->modules->list;
     return so_module_collection::make($uses);
 }
Esempio n. 2
0
 function depends_make()
 {
     $out = array();
     foreach ($this as $inId => $in) {
         if (isset($out[$inId])) {
             continue;
         }
         $mark = array($inId => $in);
         while ($mark) {
             end($mark);
             list($curId, $cur) = each($mark);
             foreach ($cur->uses as $depId => $dep) {
                 if (isset($out[$depId])) {
                     continue;
                 }
                 if (isset($mark[$depId])) {
                     continue;
                 }
                 $mark[$depId] = $dep;
                 continue 2;
             }
             $out[$curId] = $cur;
             unset($mark[$curId]);
         }
     }
     return so_module_collection::make($out);
 }
Esempio n. 3
0
 function uses_make()
 {
     $meta = new so_Tree();
     $meta->string = $this->file->content;
     $depends = array();
     foreach ($meta->get('include pack') as $packageId) {
         $package = $this->root[trim($packageId)];
         if (!$package->exists) {
             throw new \Exception("Pack [{$package->dir}] not found for [{$this->file}]");
         }
         $depends += $package->modules->list;
     }
     foreach ($meta->get('include module') as $moduleId) {
         $names = explode('/', trim($moduleId));
         if (!isset($names[1])) {
             array_push($names, $this->package->name);
         }
         $module = $this->root[$names[0]][$names[1]];
         if (!$module->exists) {
             throw new \Exception("Module [{$module->dir}] not found for [{$this->file}]");
         }
         $depends += $module->modules->list;
     }
     return so_module_collection::make($depends);
 }
Esempio n. 4
0
 function uses_make()
 {
     $list = array();
     foreach ($this as $source) {
         $list += $source->uses->list;
     }
     return so_module_collection::make($list);
 }
Esempio n. 5
0
 function modules_make()
 {
     $list = array();
     foreach ($this as $package) {
         $list += $package->modules->list;
     }
     return so_module_collection::make($list);
 }
Esempio n. 6
0
 function modules_make()
 {
     $list = array();
     foreach ($this->dir->childs as $child) {
         if ($child->type != 'dir') {
             continue;
         }
         $module = $this[$child->name];
         $list += $module->modules->list;
     }
     return so_module_collection::make($list);
 }
Esempio n. 7
0
 function uses_make()
 {
     preg_match_all('/\\b(?:extends|implements|use|new)\\s+([a-zA-Z0-9]+)_([a-zA-Z0-9]+)/', $this->file->content, $matches1, PREG_SET_ORDER);
     preg_match_all('/\\b([a-zA-Z0-9]+)_([a-zA-Z0-9]+)\\w*::/', $this->file->content, $matches2, PREG_SET_ORDER);
     $matches = array_merge($matches1, $matches2);
     $depends = array();
     if ($matches) {
         foreach ($matches as $item) {
             list($str, $packName, $moduleName) = $item;
             $module = $this->root[$packName][$moduleName];
             if (!$module->exists) {
                 throw new \Exception("Module [{$module->dir}] not found for [{$this->file}]");
             }
             $depends += $module->modules->list;
         }
     }
     return so_module_collection::make($depends);
 }
Esempio n. 8
0
 function modules_store($data)
 {
     return so_module_collection::make($data);
 }
Esempio n. 9
0
 function modules_make()
 {
     return so_module_collection::make(array((string) $this->dir => $this));
 }
Esempio n. 10
0
 function uses_make()
 {
     return so_module_collection::make();
 }