You are here

class StateMachine_State in State Machine 6

Same name and namespace in other branches
  1. 7.3 inc/base.inc \StateMachine_State
  2. 7 inc/base.inc \StateMachine_State
  3. 7.2 inc/base.inc \StateMachine_State

Hierarchy

Expanded class hierarchy of StateMachine_State

File

inc/base.inc, line 206

View source
class StateMachine_State {
  protected $machine;
  protected $options;
  public function __construct($machine, $options = array()) {
    $this->machine = $machine;
    $this->options = $options;
  }

  /**
   * 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

Namesort descending Modifiers Type Description Overrides
StateMachine_State::$machine protected property
StateMachine_State::$options protected property
StateMachine_State::on_enter public function Called when entering into this state.
StateMachine_State::on_exit public function Called when exiting out of this state.
StateMachine_State::__construct public function