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)];
    }
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)];
    }
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 ) ] ; }
Registers new filter

@param string $name
@param mixed $callback
@param string|int|null $wiringSchema
@throws InvalidArgumentException
Registers new filter