Register a new filter with the router.

@param  string  $name
@param  mixed  $callback
@return void
483334
public function filter($name, $callback)
	{
		$this->events->listen('router.filter: '.$name, $this->parseFilter($callback));
	}
415629
public function add(string $name, callable $callback): \IvoPetkov\BearFrameworkAddons\ServerRequests
    {
        $this->callbacks[$name] = $callback;
        return $this;
    }
724837
public function registerHelper(string $name, callable $callback): self
    {
        $this->helpers->add($name, $callback);
        return $this;
    }
470633
public function withAttr($name, $callback = null)
    {
        $this->each(function ($model) use ($name, $callback) {
            /** @var Model $model */
            $model && $model->withAttribute($name, $callback);
        });

        return $this;
    }
1163648
public static function register(string $name, $config)
    {
        if (\array_key_exists($name, static::$faucets)) {
            throw new ClientAlreadyRegisteredException("[{$name}] is already exists in the sink.");
        }

        static::$configs[$name] = $config;
    }
659306
public function registerEvent($event, $callback)
    {
        $eventManager = $this->getServiceLocator()->get(EventManager::CONFIG_ID);
        $eventManager->attach($event, $callback);
        $this->getServiceManager()->register(EventManager::CONFIG_ID, $eventManager);
    }
1335991
public function declareQueue($name, array $options = [], callable $callback = null)
    {
        $passive = array_key_exists('passive', $options) ? (bool)$options['passive'] : null;
        $durable = array_key_exists('durable', $options) ? (bool)$options['durable'] : null;
        $exclusive = array_key_exists('exclusive', $options) ? (bool)$options['exclusive'] : null;
        $autoDelete = array_key_exists('autoDelete', $options) ? (bool)$options['autoDelete'] : null;
        $noWait = array_key_exists('noWait', $options) ? (bool)$options['noWait'] : null;
        $arguments = array_key_exists('arguments', $options) ? $options['arguments'] : null;

        $outputFrame = Queue\QueueDeclareFrame::create(
            $name,
            $passive,
            $durable,
            $exclusive,
            $autoDelete,
            $noWait,
            $arguments
        );
        $outputFrame->frameChannelId = $this->id;
        $this->connection->command($outputFrame);

        if (is_callable($callback)) {
            $this->on(self::EVENT_ON_CHANNEL_DECLARE_QUEUE_CALLBACK, $callback);
        }
    }
1277357
public function register(string $name, callable $callback): ResolverInterface
    {
        //if it's not callable
        if (!is_callable($callback)) {
            throw ResolverException::forInvalidCallback();
        }

        $this->registry[$name] = $callback;
        return $this;
    }
475367
public static function script($name, $callback) 
    {
        if (phpQueryPlugin_Scripts::$scriptMethods[$name]) {
            throw new Exception("Script name conflict - '$name'");
        }
        phpQueryPlugin_Scripts::$scriptMethods[$name] = $callback;
    }
331301
protected function addEventListener($name, $callback)
    {
        if (Str::contains($name, '*')) {
            $callback = function ($name, array $data) use ($callback) {
                return $callback($data[0]);
            };
        }

        $this->events->listen($name, $callback);
    }
1198736
public function register($name, $callback)
    {
        $this->widgets[$name] = $callback;

        $this->registerBlade($name);
    }
1296386
public function register_handler($name, $owner, $callback)
    {
        // check name
        if (strpos($name, 'plugin.') !== 0) {
            $name = 'plugin.' . $name;
        }

        // can register handler only if it's not taken or registered by myself
        if (is_object($this->output)
            && (!isset($this->objectsmap[$name]) || $this->objectsmap[$name] == $owner)
        ) {
            $this->output->add_handler($name, $callback);
            $this->objectsmap[$name] = $owner;
        }
        else {
            rcube::raise_error(array('code' => 525, 'type' => 'php',
                'file' => __FILE__, 'line' => __LINE__,
                'message' => "Cannot register template handler $name;"
                    ." already taken by another plugin or no output object available"), true, false);
        }
    }
423741
protected function buildBasic($name, Closure $callback = null): void
    {
        if ($name instanceof Closure) {
            $callback = $name;
            $name = null;
        }

        ! empty($name) && $this->legend($name);

        $callback($this);
    }
452801
public function addRuleCallback($name, Callable $callback)
    {
        if (!is_string($name)) {
            throw new \InvalidArgumentException('Rule must be a string');
        }

        $rule = $this->createRuleCallback($name, $callback);
        $this->addRule($rule);
    }
1250514
public function callback(string $name, callable $callback): self
    {
        $this->data->callback($name, $callback);
        return $this;
    }
642115
public function route($name, $path, callable $callback)
    {
        // Modifying path from colon parameters /show/:id to bracket parameters /show/{id}
        $path = preg_replace("|(:(\w+))|", '{$2}', $path);

        // if the route is anonymous
        if (!$name) {
            $name = "N".uniqid();
        }

        $map = $this["router"]->getMap();
        $route = $map->route($name, $path, $callback);

        return $route;
    }
413483
public function addFilter(string $name, string $filter): void{
        $this->filters[$name] = $filter;
    }