You are here

protected function StateMachine::set_initial_state in State Machine 6

Same name and namespace in other branches
  1. 7.3 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 98

Class

StateMachine

Code

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