add a custom validator
@param string   $name
@param callable $callback
196724
public static function set(string $name, callable $callback)
    {
        if ($name = \trim($name)) {
            self::$validators[$name] = $callback;
        }
    }
762522
public function register($name, Closure $callback)
    {
        $this->checkCallbackName($name);

        $this->callbacks[$name] = $callback;

        return $this;
    }
1233599
private static function createValidator($name, $type)
    {
        return \call_user_func_array([Validator::create(), ValidatorType::getMethod($type)], [$name]);
    }
940022
public function bind(string $name, callable $callback): self
    {
        $this->data->bind($name, $callback);
        return $this;
    }
1318025
public function after(\Closure $callback) : ValidatorInterface
    {
        $this->after[] = function () use ($callback) {
            return call_user_func_array($callback, [$this]);
        };

        return $this;
    }
1184511
public function addModifier($name, $callback)
    {
        if (!is_callable($callback)) {
            throw new InvalidArgumentException('Invalid argument type. Callbacks must be callable.');
        }
        $this->modifiers[$name] = $callback;
        return $this;
    }
1128271
public function addCalculator(string $name, string $validation): void{
        $this->calculators[$name] = $validation;
    }
1266600
public function addUserCallback ($name, callable $callback)
	{
		if (isset ($this->usercallback[$name]))
			throw new InvalidParameter ("A usercallback with name " . $name . " is already set. Each callback must have a unique name.");

		$this->usercallback[$name] = $callback;

		return $this;
	}
250555
protected function setArray($name, callable $callback = null)
    {
        return $this->field(Type::TARRAY, $name, $callback);
    }
136832
public static function createCallback(string $name, callable $callback): DenormalizationFieldMappingBuilderInterface
    {
        $self = new self($name);
        $self->fieldDenormalizer = new CallbackFieldDenormalizer($callback);

        return $self;
    }
483334
public function filter($name, $callback)
	{
		$this->events->listen('router.filter: '.$name, $this->parseFilter($callback));
	}
462331
public function addResolver(string $name, callable $callback)
    {
        //if it's a closure, they meant to bind the callback
        if ($callback instanceof Closure) {
            //so there's no scope
            $callback = $callback->bindTo($this, get_class($this));
        }

        $this->getResolverHandler()->register($name, $callback);

        return $this;
    }
566258
public function on($type, $name, $callback)
    {
        $name = $type . '.' . $name;
        if (!isset($this->events[$name])) {
            $this->events[] = [];
        }

        $this->events[$name][] = $callback;
    }
1104930
public function addFilter($name, callable $callback)
	{
		$filter = new Filter($name, $callback);

		$this->filters->add($filter);

		return $filter;
	}
1012558
public function create($name, $callback)
    {
        $this->_name = $name;
        $this->_class = $callback();

        $GLOBALS['providers'][$this->_name] = $this->_class;
    }
415629
public function add(string $name, callable $callback): \IvoPetkov\BearFrameworkAddons\ServerRequests
    {
        $this->callbacks[$name] = $callback;
        return $this;
    }
374658
public function onRegister($name, Closure $callback)
    {
        $priority                  = $this->getPluginPriority($name);
        $this->registerCallbacks[] = compact('name', 'priority', 'callback');
    }