Registers a given FilterInterface in an internal array of filters for
later application to an instance of ImageInterface

@param  FilterInterface $filter
@param  int             $priority
@return FilterChain
321210
public function add(FilterInterface $filter, $priority = 0)
    {
        $this->filters[$priority][] = $filter;
        $this->sorted = null;

        return $this;
    }
806718
public function insert($filter, $priority)
	{
		if ( ! $filter instanceof FilterInterface)
		{
			throw new \InvalidArgumentException('The filter must be an instance of FilterInterface.');
		}
		
		if ($filter instanceof FilterChainInterface)
		{
			parent::insert($filter, [-$priority, $this->serial--]);
		}
		else
		{
			if ($this->isEmpty())
			{
				parent::insert(new FilterChain(), [0, $this->serial--]);
			}
			
			$this->top()->addFilter($filter, $priority);
		}
		
		return $this;
	}
363767
public function append(FilterChain $chain)
    {
        $priorities = array_keys($this->filters);
        if (count($priorities)) {
            $priority = max(array_keys($this->filters)) + 1;
        } else {
            $priority = 0;
        }
        $filters = $chain->getFilters();
        foreach ($filters as $filter) {
            $this->add($filter, $priority);
        }
        return $this;
    }
1336107
public function removeFilter(FilterInterface $filter)
    {

        $this->filters = array_filter($this->filters, function (FilterInterface $f) use ($filter) {

            return $f !== $filter;
        });

        return $this;
    }
1341794
public function attach(string $fqcn, FilterInterface $filter, int $priority = self::DEFAULT_PRIORITY): void
    {
        $chain = $this->factory->getChainFor($fqcn);
        $chain->attach($filter, $priority);
    }
1062494
public function addProvider(ProviderInterface $provider, $alias, $priority)
    {
        $this->providers[$alias] = array(
            'provider' => $provider,
            'priority' => $priority,
            'alias' => $alias,
        );

        uasort(
            $this->providers,
            function ($a, $b) {
                if ($a['priority'] == $b['priority']) {
                    return 0;
                }

                return $a['priority'] < $b['priority'] ? 1 : -1;
            }
        );
    }
849223
public function addFilter( $filter, $callback, $priority = 10 )
    {
        if ( !isset( $this->filters[ $filter ] ) )
        {
            $this->filters[ $filter ] = array();
        }

        $this->filters[ $filter ][] = array(
            'priority' => $priority,
            'callback' => $callback,
        );

        if ( 1 < count( $this->filters[ $filter ] ) )
        {
            usort( $this->filters[ $filter ], array( $this, '_sortByPriority' ) );
        }

        if ( $this->debug )
        {
            echo PHP_EOL . '+FILTER: ' . $filter . ' -> '
                    . $this->_serializeCallback( $callback )
                    . ' + Priority: ' . $priority . PHP_EOL;
        }
    }
1135812
public function removeFilterHandler($filterName, $filterHandlerName, $priority = 50)
    {
        $this->removeHandler(self::FILTER, $filterName, $filterHandlerName, $priority);
    }
1288955
public function isEAVFilter(FilterInterface $filter): bool
    {
        try {
            $this->getEAVAttributes($filter);

            return true;
        } catch (MissingAttributeException $e) {
            return false;
        }
    }
1333233
public function addPath($path, $priority = PriorityQueue::NORMAL)
    {
        $this->renderer->addPath($path, $priority);

        return $this;
    }
763469
public function prepend(FilterChain $chain)
    {
        $priorities = array_keys($this->filters);
        if (count($priorities)) {
            $priority = min(array_keys($this->filters)) - 1;
        } else {
            $priority = 0;
        }
        $filters = $chain->getFilters();
        foreach ($filters as $filter) {
            $this->add($filter, $priority);
        }
        return $this;
    }
1245367
protected function addFilter(AbstractFilter $filter)
    {
        $this->layout->addFilter($filter);

        $filter->setParent($this);

        if ($this->thisFilterLayoutOnly) {
            $this->thisFilterLayoutOnly = false;
            $this->layoutOnlyFilterColumns[] = $filter->getColumn();
        }

        return $this->filters[] = $filter;
    }
18969
public function addFilter($filter)
    {
        if (!($filter instanceof FilterInterface) && !is_callable($filter)) {
            $filter = FilterHelper::create($filter);
        }

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

        return $this;
    }
1261296
public function addFilter(FilterInterface $filter, int $index = null): void
    {
        if (null === $index) {
            $this->filters[$filter->getCode()] = $filter;
        } else {
            $count = \count($this->filters);
            if (!\is_int($index) && !is_numeric($index)) {
                throw new UnexpectedValueException("Given index should be an integer '{$index}' given");
            }
            if (abs($index) > $count) {
                $index = 0;
            }
            if ($index < 0) {
                $index += $count;
            }
            /** @noinspection AdditionOperationOnArraysInspection */
            $this->filters = \array_slice($this->filters, 0, $index, true) +
                [$filter->getCode() => $filter] +
                \array_slice($this->filters, $index, $count - $index, true);
        }
    }
798276
private function doFilter(TokenFilterInterface $filter, array $tokens): array
    {
        $result = [];
        foreach ($tokens as $token) {
            $result = array_merge($result, $filter->filter($token));
        }

        return $result;
    }
223577
public function AddFilter( $filter )
	{
		$this->filters[] = $filter;

		if ( count( $this->filters ) <= 1 ) return;

		usort( $this->filters, function( /** @var Filter $a */ $a, /** @var Filter $b */ $b )
		{
			return $a->sortPriority > $b->sortPriority
				? 1
				: ( $a->sortPriority < $b->sortPriority ? -1 : 0 );
		} );
	}
689967
public function registerParser($className, $priority)
    {
        // check if the class is available for TYPO3 before registering the driver
        if (!class_exists($className)) {
            throw new \InvalidArgumentException('Class ' . $className . ' does not exist.', 1468863997);
        }

        if (!is_subclass_of($className, AbstractResultParser::class)) {
            throw new \InvalidArgumentException('Parser ' . $className . ' needs to implement the AbstractResultParser.', 1468863998);
        }

        if (array_key_exists((int)$priority, $this->parsers)) {
            throw new \InvalidArgumentException('There is already a parser registerd with priority ' . (int)$priority . '.', 1468863999);
        }

        $this->parsers[(int)$priority] = $className;
    }