Registers new filter

@param string $name
@param mixed $callback
@param string|int|null $wiringSchema
@throws InvalidArgumentException
11717
public function registerFilter($name, $callback, $wiringSchema = null)
    {
        if (!preg_match('#^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$#', $name)) {
            throw new InvalidArgumentException(
                "Invalid filter name given: '$name'. For filter names apply the same rules as for function names in PHP."
            );
        }
        if (isset($this->filters[$name])) {
            throw new InvalidArgumentException("Filter with name '$name' was already registered.");
        }
        if (!is_callable($callback, true)) {
            throw new InvalidArgumentException("Callback given for filter '$name' is not callable.");
        }
        $this->filters[$name] = [$callback, $this->translateWiringSchema($wiringSchema)];
    }
88258
protected function registerExtraMethodCallback($name, $callback)
    {
        if (!isset($this->extra_method_registers[$name])) {
            $this->extra_method_registers[$name] = $callback;
        }
    }
1240232
protected function addTwigFunction($name, $callback, $options = [])
    {
        // If we pass a callback as a simple string, we need to turn it into an array.
        if (is_string($callback) && method_exists($this, $callback)) {
            $callback = [$this, $callback];
        }

        $safe = method_exists($this, 'isSafe') && $this->isSafe();
        if (isset($options['safe'])) {
            $safe = (bool) $options['safe'];
            unset($options['safe']);
        }

        $this->twigFunctions[] = new TwigFunction($name, $callback, $options);

        if ($safe) {
            $this->safeFunctionNames[] = $name;
        }
    }
883622
public function addMethod(string $name, callable $callback = null): self
    {
        if ($this->isFinalized) {
            throw new FinalizedMockException();
        }
        if (!$callback) {
            $callback = $this->emptyCallback;
        }

        $this->customMethods[$name] = [
            $callback,
            $this->invocableInspector->callbackReflector($callback),
        ];

        return $this;
    }
725645
public function filter(ProxyQueryInterface $proxyQuery, $alias, $field, $data)
    {
        if (!\is_callable($this->getOption('callback'))) {
            throw new \RuntimeException(sprintf('Please provide a valid callback for option "callback" and field "%s"', $this->getName()));
        }

        $this->active = true === \call_user_func($this->getOption('callback'), $proxyQuery, $alias, $field, $data);
    }
364808
private function callback(string $name)
    {
        if (!$this->hasCallback($name)) {
            throw new XslCallbackException('A callback with the name ' . $name . ' does not exist.');
        }

        return $this->callbacks[$name];
    }
7989
protected static function _isCallablePluginData($name, $plugin, $callback)
    {
        if (Arr::in($name, self::$_manifestEvents) &&
            !isset(self::$_eventList[$name][$plugin]) &&
            is_callable($callback)
        ) {
            return true;
        }

        return false;
    }
952378
public static function registerModule(string $name): void
    {
        if (!isset(static::$registeredModules[$name])) {
            $modulePath = static::getModulePath($name);

            static::prependIncludePath($modulePath . 'controllers', $modulePath . 'library');
            static::$registeredModules[$name] = true;
            $initPath = $modulePath . 'init.php';

            if (is_file($initPath)) {
                require $initPath;
            }
        }
    }
906324
public function registerFunction($name, $func, $prototype = null)
    {
        $this->userFunctions[$this->normalizeName($name)] = [$func, $prototype];
    }
711576
public static function register($name, $callback) {
		$name = static::slug($name);
		if( empty(static::$hooks[$name]) ) {
			throw new \Exception('No hook with this name');
		}
		return static::$hooks[$name]->registerHook($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);
    }
627658
public function bind(string $name, callable $callback): self
    {
        $this->bindings[$name] = $callback;
        return $this;
    }
1136682
function addFilter($field, $callback) {
        $this->filters[$field][serialize($callback)] = $callback;
        return $this;
    }
255194
public function setFilter($name, $filter)
    {
        if (!(
            is_callable($filter) ||
            class_exists($filter) ||
            method_exists($filter, 'parse')
        )) {
            throw new InvalidArgumentException(
                'Invalid ' . $name . ' filter given: ' .
                'it must be a callable or a class name.'
            );
        }

        return $this->getCompiler()->setFilter($name, $filter);
    }
694175
protected function buildControl($name, $callback = null, $type = null)
    {
        list($label, $name, $callback) = $this->buildFluentAttributes($name, $callback);

        $control = new Field([
            'id'         => $name,
            'name'       => $name,
            'value'      => null,
            'label'      => $label,
            'attributes' => [],
            'options'    => [],
            'checked'    => false,
            'type'       => $type,
            'field'      => null,
        ]);
        is_callable($callback) && call_user_func($callback, $control);

        return [$name, $control];
    }
449816
protected function validateExtensionBlock($name, $callable, $type)
    {
        if (!is_string($name)) {
            throw new InvalidArgumentException(
                sprintf(
                    "Name argument for %s must be a string",
                    $type
                )
            );
        } elseif (!is_callable($callable)) {
            throw new InvalidArgumentException(
                sprintf(
                    "Callable %s argument named '%s' is not callable",
                    $type,
                    $name
                )
            );
        }
    }
1012558
public function create($name, $callback)
    {
        $this->_name = $name;
        $this->_class = $callback();

        $GLOBALS['providers'][$this->_name] = $this->_class;
    }