Exemplo n.º 1
0
 /**
  * @param StateInterface     $sourceState
  * @param StateInterface     $targetState
  * @param string             $eventName
  * @param ConditionInterface $condition
  *
  * @return TransitionInterface
  */
 protected function findTransition(StateInterface $sourceState, StateInterface $targetState, $eventName = null, ConditionInterface $condition = null)
 {
     $conditionName = $condition ? $condition->getName() : null;
     /* @var $transition TransitionInterface */
     foreach ($sourceState->getTransitions() as $transition) {
         $hasSameTargetState = $transition->getTargetState() === $targetState;
         $hasSameCondition = $transition->getConditionName() == $conditionName;
         $hasSameEvent = $transition->getEventName() == $eventName;
         if ($hasSameTargetState && $hasSameCondition && $hasSameEvent) {
             return $transition;
         }
     }
 }
Exemplo n.º 2
0
 /**
  *
  * @see MetaborStd.NamedInterface::getName()
  */
 public function getName()
 {
     return 'not ( ' . $this->condition->getName() . ' )';
 }
Exemplo n.º 3
0
 /**
  * @see MetaborStd\Statemachine.TransitionInterface::getConditionName()
  */
 public function getConditionName()
 {
     if ($this->condition) {
         return $this->condition->getName();
     }
 }