/**
  * Emit broadcasts an event from the message, and if the broker
  * is set on this message, the same event is broadcast on the broker.
  *
  * @param $event
  * @param array $arguments
  * @return void
  */
 public function emit($event, array $arguments = [])
 {
     parent::emit($event, $arguments);
     if ($this->broker) {
         $this->broker->emit($event, $arguments);
     }
 }
 /**
  * Set event listeners.
  *
  * @return void
  */
 protected function listen()
 {
     $this->eventEmitter->on('peridot.concurrency.load', [$this, 'setPending']);
     $this->eventEmitter->on('peridot.concurrency.worker.run', [$this, 'addRunning']);
     $this->eventEmitter->on('peridot.concurrency.worker.completed', [$this, 'onWorkerComplete']);
     $this->broker->on('end', [$this, 'onMessageEnd']);
     $this->broker->on('error', [$this, 'onError']);
     $this->broker->on('suite.halt', [$this, 'stop']);
 }
 /**
  * @param EventEmitter $emitter
  */
 public function __construct(EventEmitter $emitter)
 {
     $this->emitter = $emitter;
     parent::__construct();
 }