izzum\statemachine\StateMachine::__call PHP Method

__call() public method

$statemachine->triggerAnEvent() actually calls $this->handle('triggerAnEvent') This is also very useful if you use object composition to include a statemachine in your domain model. The domain model itself can then use it's own __call implementation to directly delegate to the statemachines' __call method. $model->walk() will actually call $model->statemachine->walk() which will then call $model->statemachine->handle('walk'); since transition event names default to the transition name, it is possible to execute this kind of code (if the state names contain allowed characters): $statemachine->_to_(); $statemachine->eventName(); $statemachine->eventName('this is an informational message about why we do this transition');
public __call ( string $name, array $arguments ) : boolean
$name string the name of the unknown method called
$arguments array an array of arguments (if any). an argument could be $message (informational message for the transition)
return boolean true in case a transition was triggered by the event, false otherwise
    public function __call($name, $arguments)
    {
        //prepend the $name (event/trigger) to other arguments and call the 'handle' method
        array_unshift($arguments, $name);
        return call_user_func_array(array($this, 'handle'), $arguments);
    }