You are here

public function StateMachine_Event::__construct in State Machine 7.3

Same name and namespace in other branches
  1. 6 inc/base.inc \StateMachine_Event::__construct()
  2. 7 inc/base.inc \StateMachine_Event::__construct()
  3. 7.2 inc/base.inc \StateMachine_Event::__construct()

Instantiate event.

Parameters

string $name: The machine readable name of the state.

StateMachine $machine: The related machine.

array $options: The options array.

File

inc/base.inc, line 357
Defines the base classes of the state machine.

Class

StateMachine_Event
Base class for events.

Code

public function __construct($name, $machine, $options = array()) {
  $this->name = $name;
  $this->machine = $machine;

  // Normalize the origin option.
  $origin = empty($options['origin']) ? array() : $options['origin'];
  $options['origin'] = is_array($origin) ? $origin : array(
    $origin,
  );
  $this->options = $options;
  $this->title = isset($this->options['title']) ? $this->options['title'] : $name;
}