Code Duplication    Length = 17-17 lines in 2 locations

lib/Gnf/db/base.php 2 locations

@@ 183-199 (lines=17) @@
180
					$key
181
				) . ' and ' . self::escapeColumnName($key) . ' < ' . $this->escapeItemExceptNull($value->dat2, $key) . ')';
182
		}
183
		if (is_a($value, '\Gnf\db\Helper\GnfSqlAnd')) {
184
			$ret = [];
185
			foreach ($value->dat as $dat) {
186
				if (is_array($dat)) {
187
					$ret[] = '( ' . $this->serializeWhere($dat) . ' )';
188
				} elseif ($dat instanceof GnfSqlNot && is_array($dat->dat)) {
189
					$ret[] = '( ! ( ' . $this->serializeWhere($dat->dat) . ' ) )';
190
				} else {
191
					throw new InvalidArgumentException('process sqlAnd needs where(key, value pair)');
192
				}
193
			}
194
			if (count($ret)) {
195
				return '( ' . implode(' and ', $ret) . ' )';
196
			}
197
198
			return '';
199
		}
200
		if (is_a($value, '\Gnf\db\Helper\GnfSqlOr')) {
201
			$ret = [];
202
			foreach ($value->dat as $dat) {
@@ 200-216 (lines=17) @@
197
198
			return '';
199
		}
200
		if (is_a($value, '\Gnf\db\Helper\GnfSqlOr')) {
201
			$ret = [];
202
			foreach ($value->dat as $dat) {
203
				if (is_array($dat)) {
204
					$ret[] = '( ' . $this->serializeWhere($dat) . ' )';
205
				} elseif ($dat instanceof GnfSqlNot && is_array($dat->dat)) {
206
					$ret[] = '( ! ( ' . $this->serializeWhere($dat->dat) . ' ) )';
207
				} else {
208
					throw new InvalidArgumentException('process sqlOr needs where(key, value pair)');
209
				}
210
			}
211
			if (count($ret)) {
212
				return '( ' . implode(' or ', $ret) . ' )';
213
			}
214
215
			return '';
216
		}
217
		if (is_int($key)) {
218
			throw new InvalidArgumentException('cannot implict int key as column : ' . $key);
219
		}