コード例 #1
0
 public function setUp()
 {
     $this->machine = new StateMachine();
     $stateScheduled = new State(Visit::SCHEDULED);
     $stateScheduled->addTransition('do', Visit::SCHEDULED, Visit::IN_PROGRESS);
     $stateProgress = new State(Visit::IN_PROGRESS);
     $stateProgress->putTransition(new Transition('reset', Visit::IN_PROGRESS, Visit::SCHEDULED));
     $this->machine->addState($stateScheduled);
     $this->machine->addState($stateProgress);
 }
コード例 #2
0
 /**
  * @inheritdoc
  */
 public function addState(State $state)
 {
     $this->states[$state->getName()] = $state;
 }