コード例 #1
0
ファイル: Process.php プロジェクト: potfur/statemachine
 /**
  * @param string           $name         process/schema name
  * @param string           $subjectClass context class name
  * @param string           $initialState initial state for entities starting process
  * @param StateInterface[] $states
  *
  * @throws InvalidStateException
  */
 public function __construct($name, $subjectClass, $initialState, array $states)
 {
     $this->assertName($name);
     $this->name = $name;
     $this->subjectClass = $subjectClass;
     $this->initialState = $initialState;
     $this->states = new GenericCollection($states, '\\StateMachine\\StateInterface');
     if (!$this->states->has($this->initialState)) {
         throw new InvalidStateException(sprintf('Initial state "%s" does not exist in process "%s"', $this->initialState, $this->getName()));
     }
 }
コード例 #2
0
ファイル: State.php プロジェクト: potfur/statemachine
 /**
  * Return true if event exists in collection
  *
  * @param string $name
  *
  * @return bool
  */
 public function hasEvent($name)
 {
     return $this->events->has($name);
 }