manager->addProcess(HotReload::class); } else { $this->router->scan_build_route(); } $this->manager->initCoreServers(\config('server', []), $this->daemon); $this->manager->start(); } /** * @return void * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface * @throws Exception */ public function shutdown(): void { $configs = \config('server', []); $instances = $this->manager->sortService($configs['ports'] ?? []); foreach ($instances as $config) { $this->state->exit($config->port); } $this->dispatch->dispatch(new OnShutdown()); } /** * @return bool * @throws Exception */ public function isRunner(): bool { return $this->state->isRunner(); } /** * @param $daemon * @return Server */ public function setDaemon($daemon): static { if (!in_array($daemon, [0, 1])) { return $this; } $this->daemon = $daemon; return $this; } }