Code Duplication    Length = 4-5 lines in 2 locations

engine/lib/metastrings.php 2 locations

@@ 319-322 (lines=4) @@
316
			$query .= " GROUP BY {$options['group_by']}";
317
		}
318
319
		if (isset($options['order_by']) && $options['order_by']) {
320
			$options['order_by'] = sanitise_string($options['order_by']);
321
			$query .= " ORDER BY {$options['order_by']}, n_table.id";
322
		}
323
324
		if ($options['limit']) {
325
			$limit = sanitise_int($options['limit']);
@@ 726-730 (lines=5) @@
723
724
		if ($clauses['orders']) {
725
			$order_by_metadata = implode(", ", $clauses['orders']);
726
			if (isset($options['order_by']) && $options['order_by']) {
727
				$options['order_by'] = "$order_by_metadata, {$options['order_by']}";
728
			} else {
729
				$options['order_by'] = "$order_by_metadata, e.time_created DESC";
730
			}
731
		}
732
	}
733