src/Hook/Hook.php
protected function addHookEvent($hook, $callback, $priority, $accepted_args)
    {
        // Check if $callback is a closure.
        if ($callback instanceof \Closure || is_array($callback)) {
            $this->addEventListener($hook, $callback, $priority, $accepted_args);
        } elseif (is_string($callback)) {
            if (false !== strpos($callback, '@') || class_exists($callback)) {
                // Return the class responsible to handle the action.
                $callback = $this->addClassEvent($hook, $callback, $priority, $accepted_args);
            } else {
                // Used as a classic callback function.
                $this->addEventListener($hook, $callback, $priority, $accepted_args);
            }
        }

        return $callback;
    }
protected function addHookEvent($hook, $callback, $priority, $accepted_args)
    {
        // Check if $callback is a closure.
        if ($callback instanceof \Closure || is_array($callback)) {
            $this->addEventListener($hook, $callback, $priority, $accepted_args);
        } elseif (is_string($callback)) {
            if (false !== strpos($callback, '@') || class_exists($callback)) {
                // Return the class responsible to handle the action.
                $callback = $this->addClassEvent($hook, $callback, $priority, $accepted_args);
            } else {
                // Used as a classic callback function.
                $this->addEventListener($hook, $callback, $priority, $accepted_args);
            }
        }

        return $callback;
    }
protected function addHookEvent ( $ hook , $ callback , $ priority , $ accepted_args ) { // Check if $callback is a closure. if ( $ callback instanceof \ Closure || is_array ( $ callback ) ) { $ this -> addEventListener ( $ hook , $ callback , $ priority , $ accepted_args ) ; } elseif ( is_string ( $ callback ) ) { if ( false !== strpos ( $ callback , '@' ) || class_exists ( $ callback ) ) { // Return the class responsible to handle the action. $ callback = $ this -> addClassEvent ( $ hook , $ callback , $ priority , $ accepted_args ) ; } else { // Used as a classic callback function. $ this -> addEventListener ( $ hook , $ callback , $ priority , $ accepted_args ) ; } } return $ callback ; }
Add an event for the specified hook.

@param string                $hook          The hook name.
@param \Closure|string|array $callback      The hook callback instance.
@param int                   $priority      The priority order.
@param int                   $accepted_args The default number of accepted arguments.

@throws BadMethodCallException

@return \Closure|array|string
Add an event for the specified hook .