示例#1
0
 /**
  * @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);
     }
 }
示例#3
0
 /**
  * @param StateCollectionInterface $stateCollection
  */
 public function addStateCollection(StateCollectionInterface $stateCollection)
 {
     $this->addStates($stateCollection->getStates());
 }