Пример #1
0
 /**
  * @param ServesEventStreamData $eventEnvelope
  */
 protected function applyChange(ServesEventStreamData $eventEnvelope)
 {
     $event = $eventEnvelope->getPayload();
     $occurredOn = $eventEnvelope->getOccurredOn();
     $file = $eventEnvelope->getFile();
     $metaData = $eventEnvelope->getMetaData();
     $methodName = 'when' . (new Contract($event))->getClassBasename();
     if (is_callable([$this, $methodName])) {
         $this->{$methodName}($event, $occurredOn, $file, $metaData);
     }
 }
 /**
  * @param ServesEventStreamData $eventEnvelope
  */
 public function update(ServesEventStreamData $eventEnvelope)
 {
     echo get_class($eventEnvelope->getPayload()) . " with ID {$eventEnvelope->getStreamId()} was globally observed.\n";
 }
Пример #3
0
 /**
  * @param ServesEventStreamData $eventEnvelope
  *
  * @return IdentifiesEventStream
  */
 private function getStreamIdentifierForEventEnvelope(ServesEventStreamData $eventEnvelope)
 {
     return new EventStreamIdentifier($eventEnvelope->getStreamId());
 }