Append Filter

[code]
$filter->appendTo($this)
[/code]

@param iFilterStream $filter
@param int $rwFlag @see iSFilter::AppendTo

@return $this
425416
function appendFilter(iFilterStream $filter, $rwFlag = STREAM_FILTER_ALL)
    {
        $filterRes = $filter->appendTo($this);

        // store attached filter resource, so we can remove it from stream handler later
        $this->attachedFilters[$filter->getLabel()] = $filterRes;
        return $this;
    }
979244
public function add($filter)
    {
        if (is_array($filter)) {
            $this->collection[] = new Filter($filter);
        } elseif (is_object($filter) && $filter instanceof Filter) {
            $this->collection[] = $filter;
        }

        return $this;
    }
245593
public function doAsk(OutputInterface $output, FileFilter $filter)
    {
        $inputStream = $this->inputStream ? : STDIN;

        $message = $filter->getQuestion();

        $output->write($message);


        $ret = trim($this->autocomplete($output, $filter, $inputStream));

        $ret = strlen($ret) > 0 ? $ret : $filter->getDefault();

        if ($normalizer = $filter->getNormalizer()) {
            return $normalizer($ret);
        }

        return $ret;
    }
1312777
private void addFilter(Filter filter) {
        boolean exists = false;
        for (Filter initedFilter : this.filters) {
            if (initedFilter.getClass() == filter.getClass()) {
                exists = true;
                break;
            }
        }

        if (!exists) {
            filter.init(this);
            this.filters.add(filter);
        }

    }
952642
private static function fixFilterFieldPath(?Filter $filter): ? Filter
    {
        if (is_null($filter)) {
            return $filter;
        }

        $filterAsArray = $filter->toArray();
        $filterAsArray['field'] = Item::getPathByField($filterAsArray['field']);

        return Filter::createFromArray($filterAsArray);
    }
1344022
protected function registerInstanceFilter($filter)
	{
		$this->getRouter()->filter($filter, array($this, substr($filter, 1)));

		return $filter;
	}
133704
public function add(callable $filter, $priority = null)
    {
        $this->filters->insert($filter, $priority);

        return $this;
    }
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 );
		} );
	}
1172502
private void add(ConstructorFilter filter) {
        switch(operator) {
        case NOT:
            filters.add(new NegationConstructorFilter(filter));
            operator = Operator.NONE;
            break;
        case OR:
            filters.set(filters.size() - 1, 
                        new OrConstructorFilter(filters.get(filters.size() - 1), filter));
            operator = Operator.NONE;
            break;
        default:
            filters.add(filter);
            break;
        }
    }
1209254
public function filter($filter)
    {
        if (!is_a($filter, FilterBuilder::class)) {
            throw new \Exception ("Filter must be extend class 'FilterBuilder'");
        }

        $this->filter = $filter;

        return $this;
    }
1059305
public function prependBeforeFilter($filter, array $options = [])
    {
        array_unshift($this->beforeFilters, $this->parseFilter($filter, $options));
    }
1130200
public function addStreamFilter(string $filtername, $params = null): self
    {
        if (!$this->document instanceof Stream) {
            throw new Exception('The stream filter API can not be used');
        }

        $this->document->appendFilter($filtername, $this->stream_filter_mode, $params);
        $this->stream_filters[$filtername] = true;
        $this->resetProperties();
        $this->input_bom = null;

        return $this;
    }
1352339
public static function append($stream, $callback, $read_write = STREAM_FILTER_ALL)
    {
        $ret = @\stream_filter_append($stream, self::register(), $read_write, $callback);
        if ($ret === false) {
            $error = \error_get_last() + ['message' => ''];
            throw new \RuntimeException('Unable to append filter: ' . $error['message']);
        }

        return $ret;
    }
435247
public function prependAfterFilter($filter, array $options = [])
    {
        array_unshift($this->afterFilters, $this->parseFilter($filter, $options));
    }
66693
public function installFilter($filter)
    {
        if (!is_callable($filter)) {
            $f = function () { return true; };
            $filter = $this->wrap($f, $filter);
        }

        $this->filter = $filter;

        return $this;
    }
1249914
private function buildOwnerFilter(GetFilterEvent $event, $filter)
    {
        $class = $event->getTargetEntity()->getName();
        $interfaces = class_implements($class);

        if (\in_array(OwnerableInterface::class, $interfaces, true)) {
            $filter = $this->buildRequiredOwnerFilter($event, $filter);
        } elseif (\in_array(OwnerableOptionalInterface::class, $interfaces, true)) {
            $filter = $this->buildOptionalOwnerFilter($event, $filter);
        }

        return $filter;
    }
747767
protected function createFilter($filter)
    {
        if (is_callable($filter)) {
            return call_user_func($filter);
        } elseif (is_string($filter)) {
            return new $filter();
        } elseif (is_object($filter)) {
            return $filter;
        } else {
            throw new \InvalidArgumentException("Cannot convert $filter to filter");
        }
    }