Prepend filters from another filter chain

@param FilterChain $chain
@return FilterChain
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;
    }
783107
private function addFilterReq($f, $priority = FilterChain::DEFAULT_PRIORITY) {
		$this->_filtersReq->attach($f, $priority);
	}
90799
public function addWhereAny($filters)
    {
        // Parse and split predicates along with any parameters
        $filters = $this->normalisePredicates(func_get_args());
        $this->splitQueryParameters($filters, $predicates, $parameters);

        $clause = "(" . implode(") OR (", $predicates) . ")";
        return $this->addWhere(array($clause => $parameters));
    }
1107248
public void doFilter(ServletRequest request, ServletResponse response,
			FilterChain chain) throws IOException, ServletException {
		HttpServletRequest httpServletRequest = WebFilter.request.get();
		
		try {
			WebFilter.request.set((HttpServletRequest) request);
			chain.doFilter(request, response);
		} finally {
			WebFilter.request.set(httpServletRequest);
		}
	}
840813
public function merge(AdapterChain $adaptersChain)
    {
        $adapters = $adaptersChain->adapters->toArray(PriorityQueue::EXTR_BOTH);

        foreach ($adapters as $item) {
            $this->attach($item['data'], $item['priority']);
        }

        return $this;
    }
645232
@SuppressWarnings({"UnusedDeclaration"})
    protected final void addFilterChain(String pattern, Key<? extends Filter>... keys) {
        filterChains.put(pattern, keys);
    }
897747
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
        ServletRequest xRequest;
        if (request instanceof HttpServletRequest && response instanceof HttpServletResponse) {
            if (!request.isSecure() && matchesOne(request.getRemoteAddr(), securedRemoteAddresses)) {
                xRequest = new HttpServletRequestWrapper((HttpServletRequest) request) {
                    @Override
                    public boolean isSecure() {
                        return true;
                    }
                };
            } else {
                xRequest = request;
            }
            if (logger.isDebugEnabled()) {
                logger.debug("Incoming request uri=" + ((HttpServletRequest) request).getRequestURI() + " with originalSecure='"
                        + request.isSecure() + "', remoteAddr='" + request.getRemoteAddr() + "' will be seen with newSecure='"
                        + xRequest.isSecure() + "'");
            }
        } else {
            xRequest = request;
        }

        chain.doFilter(xRequest, response);
    }
1285672
public function addFilter($filters)
    {
        $filters = (array) AnConfig::unbox($filters);

        foreach ($filters as $filter) {
            if (!($filter instanceof LibBaseTemplateFilterInterface)) {
                $filter = $this->getFilter($filter);
            }
            
            //Enqueue the filter in the command chain
            $this->getCommandChain()->enqueue($filter);
            
            //Store the filter
            $this->_filters[$filter->getIdentifier()->name] = $filter;
        }
        
        return $this;
    }
1081265
@Override
    public Filter[] filterChainToArray() {
        int length = chainLength();
        Filter[] array = new Filter[length];
        Filter thisFilter = this;
        for (int i = 0; i < length; i++) {
            array[i] = thisFilter;
            thisFilter = thisFilter.getAnd();
        }
        return array;
    }
588232
public function append($filters)
    {
        if ($filters instanceof FilterBuilder) {
            $filters = $filters->getFilter();
        }

        $this->andEncapsulate((clone $filters)->setBuilder($this->getBuilder()));

        return $this;
    }
923170
public function preFilter($filterChain)
	{
		// Only cache GET and HEAD requests
		if(!in_array(Yii::app()->getRequest()->getRequestType(), array('GET', 'HEAD')))
			return true;

		$lastModified=$this->getLastModifiedValue();
		$etag=$this->getEtagValue();

		if($etag===false&&$lastModified===false)
			return true;

		if($etag)
			header('ETag: '.$etag);

		if(isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])&&isset($_SERVER['HTTP_IF_NONE_MATCH']))
		{
			if($this->checkLastModified($lastModified)&&$this->checkEtag($etag))
			{
				$this->send304Header();
				$this->sendCacheControlHeader();
				return false;
			}
		}
		elseif(isset($_SERVER['HTTP_IF_MODIFIED_SINCE']))
		{
			if($this->checkLastModified($lastModified))
			{
				$this->send304Header();
				$this->sendCacheControlHeader();
				return false;
			}
		}
		elseif(isset($_SERVER['HTTP_IF_NONE_MATCH']))
		{
			if($this->checkEtag($etag))
			{
				$this->send304Header();
				$this->sendCacheControlHeader();
				return false;
			}

		}

		if($lastModified)
			header('Last-Modified: '.gmdate('D, d M Y H:i:s', $lastModified).' GMT');

		$this->sendCacheControlHeader();
		return true;
	}
617253
def add_chain(self, chain):
        
        with self._lock:
            chain.sort(key=lambda x: x.block_num)
            for block in chain:
                block_id = block.header_signature
                if block_id not in self._cache:
                    self._cache[block_id] = self.CachedValue(block)
                    if block.previous_block_id in self._cache:
                        self._cache[block.previous_block_id].inc_count()

            if time.time() > self._next_purge_time:
                self._purge_expired()
                self._next_purge_time = time.time() + self._purge_frequency
985712
public function chain($chain)
    {
        $this->chained = collect($chain)->map(function ($job) {
            return serialize($job);
        })->all();

        return $this;
    }
1306818
public function addFilter(Filter $filter, $key = null) {
        $filter->setParser($this);

        if (!$key) {
            $key = explode('\\', get_class($filter));
            $key = str_replace('Filter', '', end($key));
        }

        $tags = $filter->getTags();

        $this->_filters[$key] = $filter;
        $this->_tags = $tags + $this->_tags;

        foreach ($tags as $tag => $options) {
            $this->_filterMap[$tag] = $key;
        }

        $filter->setupHooks($this);

        return $this;
    }
638537
public function getChainFor($fqcn)
    {
        if (!isset($this->chains[$fqcn])) {
            $this->chains[$fqcn] = new FilterChain();
        }

        return $this->chains[$fqcn];
    }
902246
protected final void removeFilter(IoFilterChain filterChain, IoFilter filter) {
        if (filterChain.contains(filter)) {
            filterChain.remove(filter);
        }
    }
1281242
public function prepend($middleware)
    {
        if (is_array($middleware)) {
            $this->queue = array_merge($middleware, $this->queue);

            return $this;
        }
        array_unshift($this->queue, $middleware);

        return $this;
    }