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;
    }
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;
    }
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 ; }
Test if the method that will handled the hook is valid

@param string $className  the namespace of the class
@param string $methodName the method name
@param bool   $block      tell if the hook is a block or a function

@return bool
Test if the method that will handled the hook is valid