public function run()
 {
     while (true) {
         $message = MessageFactory::createFromInputLine($this->stream->readLine(), $this->checkpointer);
         $responds = $message->getRespond($this->processor);
         $this->stream->writeLine($responds->asString());
     }
 }
 private function dispatchMessage(Output $message)
 {
     $this->stream->writeLine($message->asString());
     /** @var CheckpointError $message */
     $message = MessageFactory::createFromInputLine($this->stream->readLine(), $this);
     if ($message->error) {
         $this->stream->error('Error occurred then trying to checkpoint: ' . $message->error);
     }
 }
 public function error($message)
 {
     $this->stream->error($message);
     file_put_contents($this->logFilePath, "ERROR: " . $message . PHP_EOL, FILE_APPEND);
 }