private static function findActionMethod(\ReflectionClass $reflectionClass, string $action, bool $isCaseSensitive): ?\ReflectionMethod
    {
        $actionMethod = null;

        // Methods can not begin with a digit, prepend underscore to make it possible.
        if (strlen($action) > 0 && ctype_digit($action[0])) {
            $action = '_' . $action;
        }

        try {
            $actionMethod = $reflectionClass->getMethod($action . 'Action');

            if ($isCaseSensitive && $action !== substr($actionMethod->getName(), 0, strlen($action))) {
                return null;
            }

            if (!$actionMethod->isPublic()) {
                return null;
            }
        } catch (\ReflectionException $e) {
            return null;
        }

        return $actionMethod;
    }