You are here

public function StateMachine::get_available_events in State Machine 7

Same name and namespace in other branches
  1. 6 inc/base.inc \StateMachine::get_available_events()
  2. 7.3 inc/base.inc \StateMachine::get_available_events()
  3. 7.2 inc/base.inc \StateMachine::get_available_events()

Returns an array of events that are valid for the current state.

File

inc/base.inc, line 198
base.inc

Class

StateMachine
@file base.inc

Code

public function get_available_events() {
  $events = array();
  foreach (array_keys($this->events) as $key) {
    if ($this
      ->get_event($key)
      ->can_transition_from($this
      ->get_current_state())) {
      $events[] = $key;
    }
  }
  return $events;
}