You are here

protected function StateMachine::set_initial_state in State Machine 7.3

Same name and namespace in other branches
  1. 6 inc/base.inc \StateMachine::set_initial_state()
  2. 7 inc/base.inc \StateMachine::set_initial_state()
  3. 7.2 inc/base.inc \StateMachine::set_initial_state()

Set the initial state for this machine.

By default, the initial state is set the the first created state.

File

inc/base.inc, line 121
Defines the base classes of the state machine.

Class

StateMachine
The base class.

Code

protected function set_initial_state($key) {
  if (array_key_exists($key, $this->states)) {
    $this->initial_state = $key;
    return TRUE;
  }
  return FALSE;
}