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

@@ 335-353 (lines=19) @@
332
	curl_setopt($c, CURLOPT_TIMEOUT, 240);
333
	curl_setopt($c, CURLOPT_FOLLOWLOCATION, true);
334
335
	switch($method)
336
	{
337
		case 'POST':
338
			curl_setopt($c, CURLOPT_POST, true);
339
			if (is_array($data)) $data = json_encode($data, JSON_FORCE_OBJECT);
340
			curl_setopt($c, CURLOPT_POSTFIELDS, $data);
341
			break;
342
		case 'GET':
343
			if(count($data)) $url .= '?' . http_build_query($data);
344
			break;
345
		case 'FILE':
346
			curl_setopt($c, CURLOPT_HTTPHEADER, array("Content-type: $content_type"));
347
			curl_setopt($c, CURLOPT_POST, true);
348
			curl_setopt($c, CURLOPT_POSTFIELDS, file_get_contents($upload));
349
			if(count($data)) $url .= '?' . http_build_query($data);
350
			break;
351
		default:
352
			throw new Exception(__FUNCTION__.": Unknown/unimplemented method=$method!");
353
	}
354
	curl_setopt($c, CURLOPT_URL, $url);
355
356
	if (is_string($data)) $short_data = strlen($data) > 100 ? substr($data, 0, 100).' ...' : $data;