callback_class = new $class_name(); $this->worker = new Worker(); $this->worker->count = $process_num; $this->worker->name = 'Huobi Websocket'; } /** * Execute the console command. * * @return mixed */ public function handle() { $this->initWorker(); $this->bindEvent(); $this->worker->runAll(); } protected function initWorker() { global $argv; $argv[1] = $command = $this->argument('worker_command'); $mode = $this->option('mode'); isset($mode) && $argv[2] = '-' . $mode; } protected function bindEvent() { foreach ($this->events as $key => $event) { method_exists($this->callback_class, $event) && $this->worker->$event = [$this->callback_class, $event]; } } }