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 readLine()
 {
     $line = $this->stream->readLine();
     file_put_contents($this->logFilePath, "IN: " . $line . PHP_EOL, FILE_APPEND);
     return $line;
 }