Code Duplication    Length = 4-5 lines in 2 locations

api/src/Storage/Base.php 2 locations

@@ 1184-1187 (lines=4) @@
1181
			// only check columns and non-aggregate functions
1182
			if (strpos($col, '(') === false || !preg_match('/(COUNT|MIN|MAX|AVG|SUM|BIT_[A-Z]+|STD[A-Z_]*|VAR[A-Z_]*|ARRAY_AGG)\(/i', $col))
1183
			{
1184
				if (($pos = stripos($col, 'DISTINCT ')) !== false)
1185
				{
1186
					$col = substr($col, $pos+9);
1187
				}
1188
				$alias = $col;
1189
				if (stripos($col, ' AS ')) list($col, $alias) = preg_split('/ +AS +/i', $col);
1190
				// do NOT group by constant expressions
@@ 1463-1467 (lines=5) @@
1460
			$distinct_checked = false;
1461
			foreach(is_array($only_keys) ? $only_keys : explode(',', $only_keys) as $col)
1462
			{
1463
				if (!$distinct_checked)
1464
				{
1465
					if (stripos($col, 'DISTINCT ') === 0) $col = substr($col, 9);
1466
					$distinct_checked = true;
1467
				}
1468
				if (!$col || $col == '*' || $col == $this->table_name.'.*')	// all columns
1469
				{
1470
					$cols = array_merge($cols,$this->db_cols);