Code Duplication    Length = 32-32 lines in 2 locations

src/DbalDataProvider.php 1 location

@@ 159-190 (lines=32) @@
156
        return $this;
157
    }
158
159
    public function filter($fieldName, $operator, $value)
160
    {
161
         switch ($operator) {
162
            case "eq":
163
                $operator = '=';
164
                break;
165
            case "n_eq":
166
                $operator = '<>';    
167
                break;
168
            case "gt":
169
                $operator = '>';    
170
                 break;
171
            case "lt":
172
                $operator = '<';    
173
                break;
174
            case "ls_e":
175
                $operator = '<=';    
176
                break;
177
            case "gt_e":
178
                $operator = '>=';    
179
                break;
180
            case "in":
181
                $operator = 'IN';
182
                if (!is_array($value)) {
183
                    $operator = '=';
184
                }
185
                break;
186
        }
187
        $this->src->andWhere("$fieldName $operator :$fieldName");
188
        $this->src->setParameter($fieldName, $value);
189
        return $this;
190
    }
191
192
    /**
193
     * @return boolean

src/EloquentDataProvider.php 1 location

@@ 121-152 (lines=32) @@
118
    /**
119
     * {@inheritdoc}
120
     */
121
    public function filter($fieldName, $operator, $value)
122
    {
123
        switch ($operator) {
124
            case "eq":
125
                $operator = '=';
126
                break;
127
            case "n_eq":
128
                $operator = '<>';    
129
                break;
130
            case "gt":
131
                $operator = '>';    
132
                 break;
133
            case "lt":
134
                $operator = '<';    
135
                break;
136
            case "ls_e":
137
                $operator = '<=';    
138
                break;
139
            case "gt_e":
140
                $operator = '>=';    
141
                break;
142
            case "in":
143
                if (!is_array($value)) {
144
                    $operator = '=';
145
                    break;
146
                }
147
                $this->src->whereIn($fieldName, $value);
148
                return $this;
149
        }
150
        $this->src->where($fieldName, $operator, $value);
151
        return $this;
152
    }
153
}
154