class StateMachine_State in State Machine 7.2
Same name and namespace in other branches
- 6 inc/base.inc \StateMachine_State
- 7.3 inc/base.inc \StateMachine_State
- 7 inc/base.inc \StateMachine_State
Hierarchy
- class \StateMachine_State
Expanded class hierarchy of StateMachine_State
File
View source
class StateMachine_State {
public $key;
protected $machine;
protected $options;
public function __construct($key, $machine, $options = array()) {
$this->key = $key;
$this->machine = $machine;
$this->options = $options;
}
/**
* Return the $options array
*/
public function get_options() {
return $this->options;
}
/**
* Return a specific key value from the $options array
*/
public function get_option($key) {
return array_key_exists($key, $this->options) ? $this->options[$key] : FALSE;
}
/**
* Called when entering into this state.
*/
public function on_enter() {
$args = func_get_args();
if (!empty($this->options['on_enter'])) {
call_user_func_array($this->options['on_enter'], $args);
}
}
/**
* Called when exiting out of this state.
*/
public function on_exit() {
$args = func_get_args();
if (!empty($this->options['on_exit'])) {
call_user_func_array($this->options['on_exit'], $args);
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
StateMachine_State:: |
public | property | ||
StateMachine_State:: |
protected | property | ||
StateMachine_State:: |
protected | property | ||
StateMachine_State:: |
public | function | Return a specific key value from the $options array | |
StateMachine_State:: |
public | function | Return the $options array | |
StateMachine_State:: |
public | function | Called when entering into this state. | |
StateMachine_State:: |
public | function | Called when exiting out of this state. | |
StateMachine_State:: |
public | function |