コード例 #1
0
ファイル: InitialState.php プロジェクト: piece/stagehand-fsm
 /**
  * {@inheritdoc}
  *
  * @throws InvalidEventException
  *
  * @since Method available since Release 2.2.0
  */
 public function addTransitionEvent(TransitionEventInterface $event)
 {
     if ($event->getEventId() != EventInterface::EVENT_START) {
         throw new InvalidEventException(sprintf('The transition event for the state "%s" should be "%s", "%s" is specified.', $this->getStateId(), EventInterface::EVENT_START, $event->getEventId()));
     }
     parent::addTransitionEvent($event);
 }
コード例 #2
0
ファイル: StateMachine.php プロジェクト: piece/stagehand-fsm
 /**
  * Evaluates the guard for the given event.
  *
  * @param EventInterface $event
  *
  * @return bool
  *
  * @since Method available since Release 2.0.0
  */
 private function evaluateGuard(TransitionEventInterface $event)
 {
     if ($event->getGuard() === null) {
         return true;
     }
     return call_user_func($event->getGuard(), $event, $this->getPayload(), $this);
 }