Code Duplication    Length = 12-12 lines in 2 locations

Sources/Subs-Db-postgresql.php 1 location

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

Sources/Subs-Db-mysql.php 1 location

@@ 998-1009 (lines=12) @@
995
 * @param boolean $desc default false
996
 * @return string case field when ... then ... end
997
 */
998
function smf_db_custom_order($field, $array_values, $desc = false)
999
{
1000
	$return = 'CASE '. $field . ' ';
1001
	$count = count($array_values);
1002
	$then = ($desc ? ' THEN -' : ' THEN ');
1003
1004
	for ($i = 0; $i < $count; $i++)
1005
		$return .= 'WHEN ' . (int) $array_values[$i] . $then . $i . ' ';
1006
1007
	$return .= 'END';
1008
	return $return;
1009
}
1010
1011
?>