public function getTransitionByStartingStateAndFinalState(
        $startStateName,
        $finalStateName
    ) {
        $transition = array_filter(
            $this->transitions,
            function (Transition $transition) use ($startStateName, $finalStateName) {
                return
                    $transition->getStart()->getName() === $startStateName &&
                    $transition->getFinal()->getName() === $finalStateName;
            }
        );

        return !empty($transition)
            ? reset($transition)
            : null;
    }