/** * Apply initial state * s * @param \FSM\State\StateInterface $state * @throws \FSM\Exception\ClientInitializationException */ public function setInitialState(StateInterface $state) { if (!$state->isInitial()) { throw new ClientInitializationException("The first State should be of type Initial."); } elseif (!in_array($state, $this->states)) { throw new ClientInitializationException("Can not apply state as initial. " . "The state was never registered."); } $this->context->setState($state); return $this; }