Пример #1
0
 /**
  * Verifies the given state by employing a state-type specific strategy.
  *
  * @param StateInterface $state
  *
  * @throws VerificationError
  */
 protected function verifyState(StateInterface $state)
 {
     $state_name = $state->getName();
     $transition_count = isset($this->transitions[$state_name]) ? count($this->transitions[$state_name]) : 0;
     switch ($state->getType()) {
         case StateInterface::TYPE_INITIAL:
             $this->verifyInitialState($state);
             break;
         case StateInterface::TYPE_FINAL:
             $this->verifyFinalState($state, $transition_count);
             break;
         default:
             $this->verifyActiveState($state, $transition_count);
     }
 }
Пример #2
0
 /**
  * Maps the given state to one of initial_state, event_states or final_states.
  *
  * @param StateInterface $state
  */
 protected function mapState(StateInterface $state)
 {
     switch ($state->getType()) {
         case StateInterface::TYPE_FINAL:
             $this->final_states[] = $state;
             break;
         case StateInterface::TYPE_INITIAL:
             $this->initial_state = $state;
             // no break
         // no break
         default:
             $state_transitions = $this->getTransitions($state->getName());
             if (!isset($state_transitions[StateMachine::SEQ_TRANSITIONS_KEY])) {
                 $this->event_states[] = $state;
             }
     }
 }