public function validate(FsmInterface $fsm, $throwExceptions = true)
 {
     $transitionsNames = array();
     foreach ($fsm->getTransitions() as $transition) {
         $transitionsNames[] = $transition->getName();
     }
     $duplicateTransitions = $this->getDuplicates($transitionsNames);
     foreach ($duplicateTransitions as $duplicateTransition) {
         throw new Exception\DuplicateTransitionException($fsm, $duplicateTransition);
     }
 }
 public function validate(FsmInterface $fsm, $throwExceptions = true)
 {
     foreach ($fsm->getTransitions() as $transition) {
         if (!$fsm->getStateByName($transition->getFromStateName())) {
             throw new Exception\UndefinedStateException($fsm, $transition, $transition->getFromStateName());
         }
         if (!$fsm->getStateByName($transition->getToStateName())) {
             throw new Exception\UndefinedStateException($fsm, $transition, $transition->getToStateName());
         }
     }
 }