public function addTransition(Transition $transition) { if ($transition->getName() === null) { throw new FsmException('The transition must have a name'); } if (!isset($this->states[$transition->getFromStateName()])) { throw new FsmException('The transition from state does not exists'); } if (!isset($this->states[$transition->getToStateName()])) { throw new FsmException('The transition to state does not exists'); } $this->transitions[$transition->getName()] = $transition; return $this; }