Code Duplication    Length = 12-12 lines in 2 locations

Sources/Subs-Db-mysql.php 1 location

@@ 1008-1019 (lines=12) @@
1005
 * @param boolean $desc default false
1006
 * @return string case field when ... then ... end
1007
 */
1008
function smf_db_custom_order($field, $array_values, $desc = false)
1009
{
1010
	$return = 'CASE '. $field . ' ';
1011
	$count = count($array_values);
1012
	$then = ($desc ? ' THEN -' : ' THEN ');
1013
1014
	for ($i = 0; $i < $count; $i++)
1015
		$return .= 'WHEN ' . (int) $array_values[$i] . $then . $i . ' ';
1016
1017
	$return .= 'END';
1018
	return $return;
1019
}
1020
1021
/**
1022
 * Function which return the information if the database supports native replace inserts

Sources/Subs-Db-postgresql.php 1 location

@@ 989-1000 (lines=12) @@
986
 * @param boolean $desc default false
987
 * @return string case field when ... then ... end
988
 */
989
function smf_db_custom_order($field, $array_values, $desc = false)
990
{
991
	$return = 'CASE '. $field . ' ';
992
	$count = count($array_values);
993
	$then = ($desc ? ' THEN -' : ' THEN ');
994
995
	for ($i = 0; $i < $count; $i++)
996
		$return .= 'WHEN ' . (int) $array_values[$i] . $then . $i . ' ';
997
998
	$return .= 'END';
999
	return $return;
1000
}
1001
1002
/**
1003
 * Function which return the information if the database supports native replace inserts