Пример #1
0
 /**
  * @param string $mod module name
  * @return bool
  */
 public function batchConnect($mod_name = null)
 {
     $mods = array();
     if (null !== $mod_name) {
         $mods[] = $mod_name;
     } else {
         $extensionService = $this->di['mod_service']('extension');
         $mods = $extensionService->getCoreAndActiveModules();
     }
     foreach ($mods as $m) {
         $mod = $this->di['mod']($m);
         if ($mod->hasService()) {
             $class = $mod->getService();
             $reflector = new \Reflectionclass($class);
             foreach ($reflector->getMethods() as $method) {
                 $p = $method->getParameters();
                 if ($method->isPublic() && isset($p[0]) && $p[0]->getclass() && in_array($p[0]->getclass()->getName(), array('Box_Event', '\\Box_Event'))) {
                     $this->connect(array('event' => $method->getName(), 'mod' => $mod->getName()));
                 }
             }
         }
     }
     $this->_disconnectUnavailable();
     return true;
 }