Code Duplication    Length = 21-21 lines in 2 locations

src/DataSource/ArrayDataSource.php 2 locations

@@ 221-241 (lines=21) @@
218
		$values = $condition[$filter->getColumn()];
219
		$row_value = $row[$filter->getColumn()];
220
221
		if ($values['from'] !== NULL && $values['from'] !== '') {
222
			$date_from = \DateTime::createFromFormat($format, $values['from']);
223
224
			if (!($row_value instanceof \DateTime)) {
225
				/**
226
				 * Try to convert string to DateTime object
227
				 */
228
				try {
229
					$row_value = DateTimeHelper::tryConvertToDate($row_value);
230
				} catch (DataGridDateTimeHelperException $e) {
231
					/**
232
					 * Otherwise just return raw string
233
					 */
234
					return FALSE;
235
				}
236
			}
237
238
			if ($row_value->getTimeStamp() < $date_from->getTimeStamp()) {
239
				return FALSE;
240
			}
241
		}
242
243
		if ($values['to'] !== NULL && $values['to'] !== '') {
244
			$date_from = \DateTime::createFromFormat($format, $values['to']);
@@ 243-263 (lines=21) @@
240
			}
241
		}
242
243
		if ($values['to'] !== NULL && $values['to'] !== '') {
244
			$date_from = \DateTime::createFromFormat($format, $values['to']);
245
246
			if (!($row_value instanceof \DateTime)) {
247
				/**
248
				 * Try to convert string to DateTime object
249
				 */
250
				try {
251
					$row_value = DateTimeHelper::tryConvertToDate($row_value);
252
				} catch (DataGridDateTimeHelperException $e) {
253
					/**
254
					 * Otherwise just return raw string
255
					 */
256
					return FALSE;
257
				}
258
			}
259
260
			if ($row_value->getTimeStamp() > $date_from->getTimeStamp()) {
261
				return FALSE;
262
			}
263
		}
264
265
		return TRUE;
266
	}