private function buildMessage($type, $data) { $response = new PhutilConsoleMessage(); $response->setType($type); $response->setData($data); return $response; }
public function handleServerMessage(PhutilConsoleMessage $message) { $data = $message->getData(); if ($this->getArgument('excuse')) { try { phutil_console_require_tty(); } catch (PhutilConsoleStdinNotInteractiveException $ex) { $this->excuses[$data['type']] = $this->getArgument('excuse'); return null; } } $response = ''; if (isset($data['prompt'])) { $response = phutil_console_prompt($data['prompt'], idx($data, 'history')); } else { if (phutil_console_confirm($data['confirm'])) { $response = $this->getArgument('excuse'); } } if ($response == '') { throw new ArcanistUserAbortException(); } $this->excuses[$data['type']] = $response; return null; }
private function writeMessage(PhutilConsoleMessage $message) { if ($this->disabledTypes[$message->getType()]) { return $this; } if ($this->flushing) { ob_flush(); } if ($this->channel) { $this->channel->write($message); $this->channel->flush(); } else { $response = $this->server->handleMessage($message); if ($response) { $this->messages[] = $response; } } return $this; }