/** * @param $name * * @return \MetaborStd\Statemachine\StateInterface * * @throws \Exception */ public function findOrCreateState($name) { if (!$this->stateCollection->hasState($name)) { if ($this->stateCollection instanceof StateCollection) { $this->stateCollection->addState($this->createState($name)); } else { throw new \InvalidArgumentException('Overwrite this method to implement a different type!'); } } return $this->stateCollection->getState($name); }
/** */ protected function mergeStateCollection(StateCollectionInterface $source) { /* @var $sourceState StateInterface */ foreach ($source->getStates() as $sourceState) { $this->mergeState($sourceState); } }
/** * @param StateCollectionInterface $stateCollection */ public function addStateCollection(StateCollectionInterface $stateCollection) { $this->addStates($stateCollection->getStates()); }