public function replace(
        $hookName,
        $function_to_replace,
        $callable,
        $priority = 10,
        $accepted_args = 1,
        $create = true
    ) {
        $hookName = $this->sanitize($hookName);
        if (!$hookName) {
            throw new \Exception("Invalid Hook Name Specified", E_ERROR);
        }

        if (!is_callable($callable)) {
            throw new \Exception("Invalid Hook Callable Specified", E_ERROR);
        }

        if (($has = $this->has($hookName, $function_to_replace)) || $create) {
            $has && $this->remove($hookName, $function_to_replace);
            // add hooks first
            return $this->add($hookName, $callable, $priority, $accepted_args);
        }

        return false;
    }
public function replace(
        $hookName,
        $function_to_replace,
        $callable,
        $priority = 10,
        $accepted_args = 1,
        $create = true
    ) {
        $hookName = $this->sanitize($hookName);
        if (!$hookName) {
            throw new \Exception("Invalid Hook Name Specified", E_ERROR);
        }

        if (!is_callable($callable)) {
            throw new \Exception("Invalid Hook Callable Specified", E_ERROR);
        }

        if (($has = $this->has($hookName, $function_to_replace)) || $create) {
            $has && $this->remove($hookName, $function_to_replace);
            // add hooks first
            return $this->add($hookName, $callable, $priority, $accepted_args);
        }

        return false;
    }
public function replace ( $ hookName , $ function_to_replace , $ callable , $ priority = 10 , $ accepted_args = 1 , $ create = true ) { $ hookName = $ this -> sanitize ( $ hookName ) ; if ( ! $ hookName ) { throw new \ Exception ( "Invalid Hook Name Specified" , E_ERROR ) ; } if ( ! is_callable ( $ callable ) ) { throw new \ Exception ( "Invalid Hook Callable Specified" , E_ERROR ) ; } if ( ( $ has = $ this -> has ( $ hookName , $ function_to_replace ) ) || $ create ) { $ has && $ this -> remove ( $ hookName , $ function_to_replace ) ; // add hooks first return $ this -> add ( $ hookName , $ callable , $ priority , $ accepted_args ) ; } return false ; }
Replace Hooks Function, this will replace all existing hooks

@param  string    $hookName            Hook Name
@param  string    $function_to_replace Function to replace
@param  Callable  $callable            Callable
@param  integer   $priority            priority
@param  integer   $accepted_args       num count of accepted args / parameter
@param  boolean   $create              true if want to create new if not exists

@return boolean
@throws \Exception
Replace Hooks Function this will replace all existing hooks