protected function StateMachine::get_state in State Machine 6
Same name and namespace in other branches
- 7.3 inc/base.inc \StateMachine::get_state()
- 7 inc/base.inc \StateMachine::get_state()
- 7.2 inc/base.inc \StateMachine::get_state()
Return a state instance by key, lazy-loading the instance if necessary.
Parameters
$key: The string identifier of the state to be returned.
Return value
An instance of StateMachine_State, or FALSE if the key specified does not represent a valid state.
File
- inc/
base.inc, line 60
Class
Code
protected function get_state($key) {
if (!array_key_exists($key, $this->states)) {
return FALSE;
}
if (is_array($this->states[$key])) {
$options = $this->states[$key];
$this->states[$key] = new StateMachine_State($this, $options);
}
return $this->states[$key];
}