Example #1
0
 /**
  * Build event command collection
  *
  * @param array $event
  *
  * @return CommandCollection
  */
 private function buildCommands($event)
 {
     $collection = new CommandCollection();
     foreach ($this->getOffsetFromArray($event, 'commands', []) as $command) {
         $collection->add($command);
     }
     $collection->resetStatus();
     return $collection;
 }
Example #2
0
 /**
  * Triggers event and return next state name or null if there is no state change
  *
  * @param PayloadInterface $payload
  *
  * @return string
  */
 public function trigger(PayloadInterface $payload)
 {
     return $this->commands->execute($payload) ? $this->getTargetState() : $this->getErrorState();
 }