getTransition() public method

Returns a transition by its name.
public getTransition ( string $name ) : Finite\Transition\TransitionInterface
$name string
return Finite\Transition\TransitionInterface
 private function addTransitions(Digraph $graph, StateMachine $stateMachine)
 {
     foreach ($stateMachine->getStates() as $stateName) {
         $state = $stateMachine->getState($stateName);
         foreach ($state->getTransitions() as $transitionName) {
             $transition = $stateMachine->getTransition($transitionName);
             $graph->beginEdge(array($stateName, $transition->getState()), array('label' => $transitionName))->end();
         }
     }
 }
示例#2
0
 /**
  * Adds all transitions as edges.
  *
  * @param \Finite\StateMachine\StateMachineInterface $stateMachine
  */
 private function addEdges(StateMachineInterface $stateMachine)
 {
     $states = $stateMachine->getStates();
     foreach ($states as $name) {
         $state = $stateMachine->getState($name);
         /* @var $state \Finite\State\StateInterface */
         $transitions = $state->getTransitions();
         foreach ($transitions as $name) {
             $trans = $stateMachine->getTransition($name);
             /* @var $trans Finite\Transition\TransitionInterface */
             $this->graph->beginEdge(array($state->getName(), $trans->getState()), array('label' => $trans->getName()))->end();
         }
     }
 }
示例#3
0
 /**
  * Adds all transitions as edges.
  *
  * @param \Finite\StateMachine\StateMachineInterface $stateMachine
  */
 private function addEdges(StateMachineInterface $stateMachine)
 {
     $states = $stateMachine->getStates();
     foreach ($states as $sName) {
         $state = $stateMachine->getState($sName);
         $transitions = $state->getTransitions();
         foreach ($transitions as $tName) {
             $trans = $stateMachine->getTransition($tName);
             $attributes = $this->getEdgeDefaultAttributes($trans);
             if ($this->visitors) {
                 try {
                     foreach ($this->visitors as $visitor) {
                         $attributes = $visitor->getEdgeAttributes($attributes, $trans, $state, $stateMachine);
                     }
                 } catch (SkipElementException $ex) {
                     continue;
                 }
             }
             $this->graph->beginEdge([$state->getName(), $trans->getState()], $attributes)->end();
         }
     }
 }