protected function isValidHookMethod($className, $methodName, $block, $failSafe = false)
    {
        try {
            $method = new ReflectionMethod($className, $methodName);

            $parameters = $method->getParameters();

            $eventType = ($block) ?
                HookDefinition::RENDER_BLOCK_EVENT :
                HookDefinition::RENDER_FUNCTION_EVENT;

            if (!($parameters[0]->getClass()->getName() == $eventType || is_subclass_of($parameters[0]->getClass()->getName(), $eventType))) {
                $this->logAlertMessage(sprintf("Method %s should use an event of type %s. found: %s", $methodName, $eventType, $parameters[0]->getClass()->getName()));

                return false;
            }
        } catch (ReflectionException $ex) {
            $this->logAlertMessage(
                sprintf("Method %s does not exist in %s : %s", $methodName, $className, $ex),
                $failSafe
            );

            return false;
        }

        return true;
    }