SM\StateMachine\StateMachine::callCallbacks PHP Method

callCallbacks() protected method

Builds and calls the defined callbacks
protected callCallbacks ( SM\Event\TransitionEvent $event, string $position ) : boolean
$event SM\Event\TransitionEvent
$position string
return boolean
    protected function callCallbacks(TransitionEvent $event, $position)
    {
        if (!isset($this->config['callbacks'][$position])) {
            return true;
        }
        $result = true;
        foreach ($this->config['callbacks'][$position] as &$callback) {
            if (!$callback instanceof CallbackInterface) {
                $callback = $this->callbackFactory->get($callback);
            }
            $result = call_user_func($callback, $event) && $result;
        }
        return $result;
    }