Code Duplication    Length = 20-20 lines in 2 locations

Sources/Subs-Db-mysql.php 1 location

@@ 213-232 (lines=20) @@
210
			return sprintf('\'%1$s\'', mysqli_real_escape_string($connection, $replacement));
211
		break;
212
213
		case 'array_int':
214
			if (is_array($replacement))
215
			{
216
				if (empty($replacement))
217
					smf_db_error_backtrace('Database error, given array of integer values is empty. (' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__);
218
219
				foreach ($replacement as $key => $value)
220
				{
221
					if (!is_numeric($value) || (string) $value !== (string) (int) $value)
222
						smf_db_error_backtrace('Wrong value type sent to the database. Array of integers expected. (' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__);
223
224
					$replacement[$key] = (string) (int) $value;
225
				}
226
227
				return implode(', ', $replacement);
228
			}
229
			else
230
				smf_db_error_backtrace('Wrong value type sent to the database. Array of integers expected. (' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__);
231
232
		break;
233
234
		case 'array_string':
235
			if (is_array($replacement))

Sources/Subs-Db-postgresql.php 1 location

@@ 173-192 (lines=20) @@
170
			return sprintf('\'%1$s\'', pg_escape_string($replacement));
171
		break;
172
173
		case 'array_int':
174
			if (is_array($replacement))
175
			{
176
				if (empty($replacement))
177
					smf_db_error_backtrace('Database error, given array of integer values is empty. (' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__);
178
179
				foreach ($replacement as $key => $value)
180
				{
181
					if (!is_numeric($value) || (string) $value !== (string) (int) $value)
182
						smf_db_error_backtrace('Wrong value type sent to the database. Array of integers expected. (' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__);
183
184
					$replacement[$key] = (string) (int) $value;
185
				}
186
187
				return implode(', ', $replacement);
188
			}
189
			else
190
				smf_db_error_backtrace('Wrong value type sent to the database. Array of integers expected. (' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__);
191
192
		break;
193
194
		case 'array_string':
195
			if (is_array($replacement))