/** * Done * * @return Definition * @throws Exception */ public function done() { if ($this->from === null) { throw new Exception('Missing From State'); } if ($this->to === null) { throw new Exception('Missing To State'); } if ($this->label == null) { throw new Exception('Missing Label'); } $this->from->addTransition(new Transition($this->label, $this->to, $this->guard, $this->action)); return $this->definition; }
/** * @inheritDoc */ public function copy(&$visited = []) { return new self($this->to->copy($visited)); }
/** * Visit State * * @param State $state * * @return void */ public function visit(State $state) { foreach ($state->getTransitions() as $transition) { $this->transitions[$transition] = 'T' . ++$this->id; } }