raoul2000\workflow\events\WorkflowEvent::__construct PHP Method

__construct() public method

Create a WorkflowEvent instance.
public __construct ( string $name, array $config = [] )
$name string name of the event.
$config array configuration array that may contain following keys : 'start', 'end', 'transition'
    public function __construct($name, array $config = [])
    {
        if (empty($name)) {
            throw new WorkflowException('Failed to create event instance : missing $name value');
        } else {
            $this->name = $name;
        }
        if (isset($config['start'])) {
            $this->_start = $config['start'];
            unset($config['start']);
        }
        if (isset($config['end'])) {
            $this->_end = $config['end'];
            unset($config['end']);
        }
        if (isset($config['transition'])) {
            $this->_transition = $config['transition'];
            unset($config['transition']);
        }
        unset($config['name']);
        parent::__construct($config);
    }