Code Duplication    Length = 12-12 lines in 2 locations

Sources/Subs-Db-mysql.php 1 location

@@ 1051-1062 (lines=12) @@
1048
 * @param boolean $desc default false
1049
 * @return string case field when ... then ... end
1050
 */
1051
function smf_db_custom_order($field, $array_values, $desc = false)
1052
{
1053
	$return = 'CASE '. $field . ' ';
1054
	$count = count($array_values);
1055
	$then = ($desc ? ' THEN -' : ' THEN ');
1056
1057
	for ($i = 0; $i < $count; $i++)
1058
		$return .= 'WHEN ' . (int) $array_values[$i] . $then . $i . ' ';
1059
1060
	$return .= 'END';
1061
	return $return;
1062
}
1063
1064
?>

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
?>