input->getArgument('name', null); if (empty($managerName)) { throw new Exception('文件名称不能为空~'); } $service = $this->input->getArgument('service', strtolower($managerName)); $port = $this->input->getArgument('port', 443); $mode = $this->input->getArgument('mode', 'SWOOLE_SOCK_TCP'); $html = ' \'127.0.0.1\', \'port\' => 5377]; /** * @return Client * @throws Exception */ public function initClient(): Client { // TODO: Implement initClient() method. return $this->client = $this->rpc->getClient(\'' . $service . '\'); } /** * @param string $event * @param array $params * @throws Exception */ #[Consumer(\'default\')] public function push(string $event, array $params) { } }'; if (!is_dir(APP_PATH . 'app/Client/Rpc/')) { mkdir(APP_PATH . 'app/Client/Rpc/', 0777, true); } $file = APP_PATH . 'app/Client/Rpc/' . $managerName . 'Middleware.php'; if (file_exists($file)) { throw new Exception('File exists.'); } Kiri::writeFile($file, $html); return [$managerName . 'Middleware.php']; } }