/**
  * To
  *
  * @param string|State  $state
  * @param string        $type
  *
  * @return $this
  */
 public function to($state, $type = State::TYPE_NORMAL)
 {
     if (!$state instanceof State) {
         $state = $this->definition->getState($state, $type);
     }
     $this->to = $state;
     return $this;
 }
Пример #2
0
 private function groupSequences()
 {
     if (empty($this->sequences) && empty($this->sequence)) {
         return null;
     }
     $group = new Definition('Group');
     $choices = array_merge($this->sequences, [$this->sequence]);
     foreach ($choices as $choice) {
         if (count($choice) == 0) {
             continue;
         }
         $group->getState('start')->addTransition(new ShortcutTransition($choice[0]->getState('start')));
         end($choice)->getState('end')->addTransition(new ShortcutTransition($group->getState('end')));
     }
     return $group;
 }