/** * rpc response. * * @param \Recca0120\Terminal\TerminalManager $terminalManger * * @return mixed */ public function endpoint(TerminalManager $terminalManger) { if ($this->request->hasSession() === true) { $session = $this->request->session(); if ($session->isStarted() === true) { $session->save(); } } $kernel = $terminalManger->getKernel(); $command = $this->request->get('command'); $status = $kernel->call($command); return $this->responseFactory->json(['jsonrpc' => $this->request->get('jsonrpc'), 'id' => $this->request->get('id'), 'result' => $kernel->output(), 'error' => $status]); }