You are here

protected function StateMachine::set_initial_state in State Machine 7.2

Same name and namespace in other branches
  1. 6 inc/base.inc \StateMachine::set_initial_state()
  2. 7.3 inc/base.inc \StateMachine::set_initial_state()
  3. 7 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 103
base.inc

Class

StateMachine
@file base.inc

Code

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