src/Hook.php
public function exists($hookName, $functionToCheck = false)
    {
        $hookName = $this->sanitizeKeyName($hookName);
        if (! $hookName || ! isset($this->filters[$hookName])) {
            return false;
        }

        // Don't reset the internal array pointer
        $has    = empty($this->filters[$hookName]);
        // Make sure at least one priority has a filter callback
        if ($has) {
            $exists = false;
            foreach ($this->filters[$hookName] as $callbacks) {
                if (! empty($callbacks)) {
                    $exists = true;
                    break;
                }
            }

            if (! $exists) {
                $has = false;
            }
        }

        // recheck
        if ($functionToCheck === false || $has === false) {
            return $has;
        }

        if (! $id = $this->uniqueId($functionToCheck)) {
            return false;
        }

        foreach ($this->filters[$hookName] as $priority) {
            if (isset($priority[$id])) {
                return $priority;
            }
        }

        return false;
    }
public function exists($hookName, $functionToCheck = false)
    {
        $hookName = $this->sanitizeKeyName($hookName);
        if (! $hookName || ! isset($this->filters[$hookName])) {
            return false;
        }

        // Don't reset the internal array pointer
        $has    = empty($this->filters[$hookName]);
        // Make sure at least one priority has a filter callback
        if ($has) {
            $exists = false;
            foreach ($this->filters[$hookName] as $callbacks) {
                if (! empty($callbacks)) {
                    $exists = true;
                    break;
                }
            }

            if (! $exists) {
                $has = false;
            }
        }

        // recheck
        if ($functionToCheck === false || $has === false) {
            return $has;
        }

        if (! $id = $this->uniqueId($functionToCheck)) {
            return false;
        }

        foreach ($this->filters[$hookName] as $priority) {
            if (isset($priority[$id])) {
                return $priority;
            }
        }

        return false;
    }
public function exists ( $ hookName , $ functionToCheck = false ) { $ hookName = $ this -> sanitizeKeyName ( $ hookName ) ; if ( ! $ hookName || ! isset ( $ this -> filters [ $ hookName ] ) ) { return false ; } // Don't reset the internal array pointer $ has = empty ( $ this -> filters [ $ hookName ] ) ; // Make sure at least one priority has a filter callback if ( $ has ) { $ exists = false ; foreach ( $ this -> filters [ $ hookName ] as $ callbacks ) { if ( ! empty ( $ callbacks ) ) { $ exists = true ; break ; } } if ( ! $ exists ) { $ has = false ; } } // recheck if ( $ functionToCheck === false || $ has === false ) { return $ has ; } if ( ! $ id = $ this -> uniqueId ( $ functionToCheck ) ) { return false ; } foreach ( $ this -> filters [ $ hookName ] as $ priority ) { if ( isset ( $ priority [ $ id ] ) ) { return $ priority ; } } return false ; }
Check if hook name exists

@param  string       $hookName        Hook name
@param  string|mixed $functionToCheck Specially Functions on Hook

@return boolean|int
Check if hook name exists