public function filterCondition(array $data, $condition)
    {
        if (empty($condition)) {
            return $data;
        }

        if (!is_array($condition)) {
            throw new InvalidParamException('Condition must be an array');
        }

        if (isset($condition[0])) { // operator format: operator, operand 1, operand 2, ...
            $operator = strtoupper($condition[0]);
            if (isset($this->conditionFilters[$operator])) {
                $method = $this->conditionFilters[$operator];
            } else {
                $method = 'filterSimpleCondition';
            }

            array_shift($condition);

            return $this->$method($data, $operator, $condition);
        } else { // hash format: 'column1' => 'value1', 'column2' => 'value2', ...
            return $this->filterHashCondition($data, $condition);
        }
    }
public function filterCondition(array $data, $condition)
    {
        if (empty($condition)) {
            return $data;
        }

        if (!is_array($condition)) {
            throw new InvalidParamException('Condition must be an array');
        }

        if (isset($condition[0])) { // operator format: operator, operand 1, operand 2, ...
            $operator = strtoupper($condition[0]);
            if (isset($this->conditionFilters[$operator])) {
                $method = $this->conditionFilters[$operator];
            } else {
                $method = 'filterSimpleCondition';
            }

            array_shift($condition);

            return $this->$method($data, $operator, $condition);
        } else { // hash format: 'column1' => 'value1', 'column2' => 'value2', ...
            return $this->filterHashCondition($data, $condition);
        }
    }
public function filterCondition ( array $ data , $ condition ) { if ( empty ( $ condition ) ) { return $ data ; } if ( ! is_array ( $ condition ) ) { throw new InvalidParamException ( 'Condition must be an array' ) ; } if ( isset ( $ condition [ 0 ] ) ) { // operator format: operator, operand 1, operand 2, ... $ operator = strtoupper ( $ condition [ 0 ] ) ; if ( isset ( $ this -> conditionFilters [ $ operator ] ) ) { $ method = $ this -> conditionFilters [ $ operator ] ; } else { $ method = 'filterSimpleCondition' ; } array_shift ( $ condition ) ; return $ this -> $ method ( $ data , $ operator , $ condition ) ; } else { // hash format: 'column1' => 'value1', 'column2' => 'value2', ... return $ this -> filterHashCondition ( $ data , $ condition ) ; } }
Applies filter conditions.

@param array $data data to be filtered
@param array $condition filter condition

@return array filtered data

@throws InvalidParamException
Applies filter conditions .