Add a filter.

@since 160524 Initial release.

@param string   $hook     A hook.
@param callable $callable Callable.
@param mixed    ...$args  Any additional args.

@return bool See {@link add_filter()}
503041
public function addFilter(string $hook, callable $callable, ...$args)
    {
        return add_filter($this->App->Config->©brand['©var'].'_'.$hook, $callable, ...$args);
    }
1343076
protected function remove_filter( $hook, $method, $priority = 10, $arg_count = 1 ) {
		return remove_filter(
			$hook,
			$this->map_filter( $this->get_wp_filter_id( $hook, $method, $priority ), $method, $arg_count ),
			$priority,
			$arg_count
		);
	}
1076803
public function with($hook)
    {
        if (!in_array($hook, PluginInterface::VALID_HOOKS)) {
            throw new InvalidArgumentException("The `{$hook}` hook is not a known plugin hook.");
        }
        foreach ($this as $plugin) {
            if ($plugin->isEnabled($hook)) {
                yield $plugin;
            }
        }
    }
664097
protected function addEventListener($name, $callback, $priority, $accepted_args)
    {
        $this->hooks[$name] = [$callback, $priority, $accepted_args];
        $this->addFilter($name, $callback, $priority, $accepted_args);
    }
806812
public function addFilter(string $filterName, callable  $callback, int $priority = 20, $args = 1)
	{
		$this->filters[$filterName][$priority][] = [$callback,$args];
	}
18969
public function addFilter($filter)
    {
        if (!($filter instanceof FilterInterface) && !is_callable($filter)) {
            $filter = FilterHelper::create($filter);
        }

        $this->filter->addFilter($filter);

        return $this;
    }
624816
public function addHook( $triggers, callable $callable, $key = null )
	{
		if ( !is_array( $triggers ) )
			$triggers = [$triggers];

		if ( is_null( $key ) )
		{
			$key = 0;
			while ( array_key_exists( $key, $this->hooks ) )
			{
				$key++;
			}
		}

		$this->hooks[$key] = ['triggers' => $triggers, 'callable' => $callable];
		$this->bakeTriggers();
	}
1348116
public function applyFilters($hook, $value)
    {
        $hook = (string) $hook;
        if (empty($this->hooks[$hook])) {
            return $value; // No hooks.
        }
        $hook_filters = $this->hooks[$hook];
        $args         = func_get_args();
        ksort($hook_filters);

        foreach ($hook_filters as $_hook_filter) {
            foreach ($_hook_filter as $_filter) {
                if (!isset($_filter['function'], $_filter['accepted_args'])) {
                    continue; // Not a valid filter in this case.
                }
                $args[1] = $value; // Continously update the argument `$value`.
                $value   = call_user_func_array($_filter['function'], array_slice($args, 1, $_filter['accepted_args']));
            }
        }
        unset($_hook_filter, $_filter); // Housekeeping.

        return $value; // With applied filters.
    }
919333
public static function call(callable $callable, $args=[])
    {
        if (!is_array($args)) {
            $args = [$args];
        }

        switch (count($args)) {
            case 0:
                return call_user_func($callable);
            case 1:
                return call_user_func($callable, $args[0]);
            case 2:
                return call_user_func($callable, $args[0], $args[1]);
            case 3:
                return call_user_func($callable, $args[0], $args[1], $args[2]);
            case 4:
                return call_user_func($callable, $args[0], $args[1], $args[2], $args[3]);
        }

        return call_user_func_array($callable, $args);
    }
1317458
public function where(callable $filter)
    {
        $filtered = [];

        foreach ($this->array as $key => $value) {
            if ($filter($key, $value) === true) {
                $filtered[$key] = $value;
            }
        }

        return $filtered;
    }
1295105
public function addFilterCallback($callback, $flags = null)
    {
        $flags = (int) $flags;

        if ($flags & self::FILTER_REPLACE_ENTRY) {
            $this->filterEntryCallbacks = [];
        }

        if ($flags & self::FILTER_REPLACE_EXIT) {
            $this->filterExitCallbacks = [];
        }

        // Called when entry records came
        if (($flags & self::FILTER_ENTRY) || !($flags & self::FILTER_EXIT)) {
            if ($flags & self::FILTER_APPEND_ENTRY) {
                $this->filterEntryCallbacks[] = $callback;

            } else {
                \array_unshift($this->filterEntryCallbacks, $callback);
            }
        }

        // Called when exit records came
        if ($flags & self::FILTER_EXIT) {
            if ($flags & self::FILTER_APPEND_EXIT) {
                $this->filterExitCallbacks[] = $callback;

            } else {
                \array_unshift($this->filterExitCallbacks, $callback);
            }
        }
    }
512472
def add_hook(self, name, function):
        
        if not callable(function):
            return ValueError('Hook function should be callable')
        if name not in self.hooks:
            self.hooks[name] = []
        self.hooks[name].append(function)
        return self
659264
public function addFilter($name, $callable) {
        $filter = new RouteFilter($name, $callable);
        $this->getRoutesMatcher()->getFiltersMatcher()
            ->addFilter($filter);

        return $this;
    }
336671
public function addFilter($filter)
    {
        if (!$filter instanceof FilterInterface) {
            if (!is_callable($filter)) {
                throw new \InvalidArgumentException('Filter should be callable or ' . FilterInterface::class);
            }

            $filter = new CallbackFilter($filter);
        }

        $this->filters[] = $filter;

        return $this;
    }
662743
public static function call(callable $callable, $args=null)
    {

        if (!is_array($args)) {
            $args = $args === null ? [] : [$args];
        }

        return static::callFast($callable, static::evaluateArgs($args));

    }
1341743
public static function push($callable, $args = [], $options = [])
    {
        $config = Hash::get($options, 'config', 'default');
        $queue = static::queue($config);

        return $queue->push($callable, $args, $options);
    }
532033
def add_hook(hook, &block)
      fail ArgumentError, "Invalid hook `#{hook}'" unless\
        HOOKS.keys.include? hook
      fail ArgumentError, 'Block require' unless block_given?
      options[hook] = block
    end