Code Duplication    Length = 19-19 lines in 2 locations

doc/rpm-build/checkout-build-archives.php 1 location

@@ 476-494 (lines=19) @@
473
	curl_setopt($c, CURLOPT_TIMEOUT, 240);
474
	curl_setopt($c, CURLOPT_FOLLOWLOCATION, true);
475
476
	switch($method)
477
	{
478
		case 'POST':
479
			curl_setopt($c, CURLOPT_POST, true);
480
			if (is_array($data)) $data = json_encode($data, JSON_FORCE_OBJECT);
481
			curl_setopt($c, CURLOPT_POSTFIELDS, $data);
482
			break;
483
		case 'GET':
484
			if(count($data)) $url .= '?' . http_build_query($data);
485
			break;
486
		case 'FILE':
487
			curl_setopt($c, CURLOPT_HTTPHEADER, array("Content-type: $content_type"));
488
			curl_setopt($c, CURLOPT_POST, true);
489
			curl_setopt($c, CURLOPT_POSTFIELDS, file_get_contents($upload));
490
			if(count($data)) $url .= '?' . http_build_query($data);
491
			break;
492
		default:
493
			throw new Exception(__FUNCTION__.": Unknown/unimplemented method=$method!");
494
	}
495
	curl_setopt($c, CURLOPT_URL, $url);
496
497
	if (is_string($data)) $short_data = strlen($data) > 100 ? substr($data, 0, 100).' ...' : $data;

install-cli.php 1 location

@@ 282-300 (lines=19) @@
279
	curl_setopt($c, CURLOPT_TIMEOUT, 240);
280
	curl_setopt($c, CURLOPT_FOLLOWLOCATION, true);
281
282
	switch($method)
283
	{
284
		case 'POST':
285
			curl_setopt($c, CURLOPT_POST, true);
286
			if (is_array($data)) $data = json_encode($data, JSON_FORCE_OBJECT);
287
			curl_setopt($c, CURLOPT_POSTFIELDS, $data);
288
			break;
289
		case 'GET':
290
			if(count($data)) $url .= '?' . http_build_query($data);
291
			break;
292
		case 'FILE':
293
			curl_setopt($c, CURLOPT_HTTPHEADER, array("Content-type: $content_type"));
294
			curl_setopt($c, CURLOPT_POST, true);
295
			curl_setopt($c, CURLOPT_POSTFIELDS, file_get_contents($upload));
296
			if(count($data)) $url .= '?' . http_build_query($data);
297
			break;
298
		default:
299
			throw new Exception(__FUNCTION__.": Unknown/unimplemented method=$method!");
300
	}
301
	curl_setopt($c, CURLOPT_URL, $url);
302
303
	if (is_string($data)) $short_data = strlen($data) > 100 ? substr($data, 0, 100).' ...' : $data;