Process filter params

@param string $key   Param name
@param string $param Param value

@return void
17471
private function processFilterParams($key, $param)
    {
        $this->filter[] = [
            $key,
            '=',
            (is_numeric($param)) ? (float) $param : $param
        ];
    }
1076180
public function setParams( $key, $value = '' ) {
		//if (!isset($this->params)) $this->params = array();

		if ( is_array( $key ) ) {
			self::$RealParams = $key;
		} else {
			self::$RealParams[ $key ] = $value;
		}

	}
1133153
protected function filter($key, $value)
    {
        extract($this->formatParam($key, $value));

        if (! $this->canFilter($column)) {
            return;
        }

        if ($comparator == 'IN') {
            $values = explode(',', $value);
            $this->getHandler()->whereIn($column, $values);
        } elseif ($comparator == 'NOT IN') {
            $values = explode(',', $value);
            $this->getHandler()->whereNotIn($column, $values);
        } else {
            $values = explode('|', $value);
            if (count($values) > 1) {
                $this->getHandler()->where(function ($query) use ($column, $comparator, $values) {
                    foreach ($values as $value) {
                        if ($comparator == 'LIKE' || $comparator == 'NOT LIKE') {
                            $value = preg_replace('/(^\*|\*$)/', '%', $value);
                        }
                        // Link the filters with AND of there is a "not" and with OR if there's none
                        if ($comparator == '!=' || $comparator == 'NOT LIKE') {
                            $query->where($column, $comparator, $value);
                        } else {
                            $query->orWhere($column, $comparator, $value);
                        }
                    }
                });
            } else {
                $value = $values[0];
                if ($comparator == 'LIKE' || $comparator == 'NOT LIKE') {
                    $value = preg_replace('/(^\*|\*$)/', '%', $value);
                }
                if ($comparator == 'NULL' || $comparator == 'NOT NULL') {
                    $this->getHandler()->whereNull($column, 'and', $comparator == 'NOT NULL');
                } else {
                    $this->getHandler()->where($column, $comparator, $value);
                }
            }
        }
    }
382127
static function processQuery($query, $queryParams) 
    {
        $search = Util::get($queryParams, 'search', '1=1');
        $searchSql = "WHERE $search";

        $order = Util::get($queryParams, 'order', '');
        $orderSql = ! empty($order) ? "ORDER BY $order" : "";
            
        $start = (int) Util::get($queryParams, 'start', 0) + 1;
        $length = (int) Util::get($queryParams, 'length', -1);
        $end = $start + $length;
        $limitSearchSql = $searchSql . ($length > -1 ? " AND rownum < $end" : "");
        // Oracle version >= 12
        // $limit =  $length > -1 ? 
        //     "OFFSET $start ROWS FETCH NEXT $length ROWS ONLY" : ""; 

        $filterQuery = "SELECT count(*) FROM ($query) tmp $searchSql";
        $totalQuery = "SELECT count(*) FROM ($query) tmp";
        $processedQuery = "select * from (select a.*, rownum as rnum 
            from (select * from ($query) $orderSql) a $limitSearchSql ) tmp 
            where rnum >= $start";
        // echo "query=" . $processedQuery . '<br>';
        return [$processedQuery, $totalQuery, $filterQuery];
    }
436428
public function addParam($value, $key = null)
    {
        if ($key === null || is_int($key)) {
            $this->params[] = $value;
        } else {
            $this->params[$key] = $value;
        }
    }
1336385
public function process(Aoe_ExtendedFilter_Model_Interface $filter, array $params)
    {
        // Re-parse the third parameter with the tokenizer and discard original parameters
        $params = $filter->getIncludeParameters($params[2]);

        // Pull out expected parameters
        $text = (isset($params['text']) ? $params['text'] : '');
        $modifiers = (isset($params['modifiers']) ? $params['modifiers'] : '');
        $module = (isset($params['module']) ? $params['module'] : 'core');

        // Create helper here as a fail-fast
        $helper = Mage::helper($module);

        // Prep parameters for translation call
        unset($params['text']);
        unset($params['modifiers']);
        unset($params['module']);
        array_unshift($params, $text);

        // Translate the text
        $text = call_user_func_array([$helper, '__'], $params);

        // If we have modifiers, process now
        if (!empty($modifiers)) {
            $text = $filter->amplifyModifiers($text, $modifiers);
        }

        return $text;
    }
1255633
protected function applyParameter($key, $value)
    {
        if ($key == $this->sortParameter) {
            $this->applySorting($value);
            return;
        }

        $this->applyFilter($key, $value);
    }
45954
protected function processArray(Parameter $param, &$value)
    {
        // Convert the node if it was meant to be an array
        if (!isset($value[0])) {
            // Collections fo nodes are sometimes wrapped in an additional array. For example:
            // <Items><Item><a>1</a></Item><Item><a>2</a></Item></Items> should become:
            // array('Items' => array(array('a' => 1), array('a' => 2))
            // Some nodes are not wrapped. For example: <Foo><a>1</a></Foo><Foo><a>2</a></Foo>
            // should become array('Foo' => array(array('a' => 1), array('a' => 2))
            if ($param->getItems() && isset($value[$param->getItems()->getWireName()])) {
                // Account for the case of a collection wrapping wrapped nodes: Items => Item[]
                $value = $value[$param->getItems()->getWireName()];
                // If the wrapped node only had one value, then make it an array of nodes
                if (!isset($value[0]) || !is_array($value)) {
                    $value = array($value);
                }
            } elseif (!empty($value)) {
                // Account for repeated nodes that must be an array: Foo => Baz, Foo => Baz, but only if the
                // value is set and not empty
                $value = array($value);
            }
        }

        foreach ($value as &$item) {
            $this->recursiveProcess($param->getItems(), $item);
        }
    }
1096133
private void setParameter(String key, Object value){
        if (value == null){
            parameters.remove(key);
        }     
        else{
            parameters.put(key, value);
        }
    }
940769
public function withQueryParam($key, $value)
    {
        $params = $this->getQueryParams();
        $params[$key] = $value;
        $this->queryParams = $params;
    }
512461
protected function add_filter($key, $value, $allowmultiple = false) {
        if ($allowmultiple || empty($this->get_filter_values($key))) {
            $this->filtersapplied[] = [$key, $value];
        }
    }
1271243
public function setParam($name, $value): void
    {
        if (\is_array($this->params)) {
            // Arrays or objects implementing array access
            $this->params[$name] = $value;
        } else {
            // Objects
            $this->params->{$name} = $value;
        }
    }
450317
public function setParams($params)
    {
        // $param should be a single key => value pair
        if (is_array($params)) {
            foreach ($params as $key => $param) {
                $this->params[$key] = $param;
            }
        }
    }
690804
private function filterParameters(array $params): array
    {
        return
            array_filter(
                $params,
                function (&$value) {
                    if (is_array($value)) {
                        $value = $this->filterParameters($value);

                        return count($value) > 0;
                    } else {
                        return !is_null($value);
                    }
                }
            );
    }
1070662
protected function processObject(Parameter $param, &$value)
    {
        // Ensure that the array is associative and not numerically indexed
        if (!isset($value[0]) && ($properties = $param->getProperties())) {
            $knownProperties = array();
            foreach ($properties as $property) {
                $name = $property->getName();
                $sentAs = $property->getWireName();
                $knownProperties[$name] = 1;
                if ($property->getData('xmlAttribute')) {
                    $this->processXmlAttribute($property, $value);
                } elseif (isset($value[$sentAs])) {
                    $this->recursiveProcess($property, $value[$sentAs]);
                    if ($name != $sentAs) {
                        $value[$name] = $value[$sentAs];
                        unset($value[$sentAs]);
                    }
                }
            }

            // Remove any unknown and potentially unsafe properties
            if ($param->getAdditionalProperties() === false) {
                $value = array_intersect_key($value, $knownProperties);
            }
        }
    }
623155
public function setParam($key, $value = null)
    {

        return null !== $this->getDraft() ? $this->getDraft()->setParam($key, $value) : parent::setParam($key, $value);
    }
396993
protected function processFilters()
    {
        $this->filters = [];
        foreach ($this->params as $key => $value) {
            $this->parser->setAlias('_' . $this->contentType);
            $filter = $this->parser->getFilter($key, $value);
            if ($filter) {
                $this->addFilter($filter);
            }
        }
    }