protected function initMonitor()
 {
     Application::RegisterClass(\DIServer\Monitor\SwooleTable::class);
     Application::RegisterInterfaceByClass(\DIServer\Interfaces\IMonitor::class, \DIServer\Monitor\SwooleTable::class);
     $monitor = Application::GetInstance(\DIServer\Interfaces\IMonitor::class);
     $monitor->Bind();
 }
 protected function loadService($servicesConfig = [])
 {
     foreach ($servicesConfig as $iface => $imp) {
         Application::RegisterClass($imp);
         if (Application::IsAbstract($iface)) {
             Application::RegisterInterfaceByClass($iface, $imp);
         }
     }
 }
Example #3
0
 private function _tryRegitryHandler($handlerID, $handlerClassName)
 {
     if (class_exists($handlerClassName)) {
         $handlerRefClass = new \ReflectionClass($handlerClassName);
         if ($handlerRefClass->isSubclassOf(IHandler::class)) {
             Application::RegisterClass($handlerClassName);
             Application::RegisterInterfaceByClass(IHandler::class, $handlerRefClass->getName(), $handlerRefClass->getName());
             $handlerObj = Application::GetInstance(IHandler::class, $handlerRefClass->getName());
             $this->handlers[$handlerID][] = $handlerObj;
         } else {
             Log::Warning("Load {$handlerClassName} is not instance of IHandler.");
         }
     } else {
         Log::Warning("Try to load {$handlerClassName} but not exist.");
     }
 }