Code Duplication    Length = 19-19 lines in 2 locations

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

@@ 520-538 (lines=19) @@
517
	curl_setopt($c, CURLOPT_TIMEOUT, 240);
518
	curl_setopt($c, CURLOPT_FOLLOWLOCATION, true);
519
520
	switch($method)
521
	{
522
		case 'POST':
523
			curl_setopt($c, CURLOPT_POST, true);
524
			if (is_array($data)) $data = json_encode($data, JSON_FORCE_OBJECT);
525
			curl_setopt($c, CURLOPT_POSTFIELDS, $data);
526
			break;
527
		case 'GET':
528
			if(count($data)) $url .= '?' . http_build_query($data);
529
			break;
530
		case 'FILE':
531
			curl_setopt($c, CURLOPT_HTTPHEADER, array("Content-type: $content_type"));
532
			curl_setopt($c, CURLOPT_POST, true);
533
			curl_setopt($c, CURLOPT_POSTFIELDS, file_get_contents($upload));
534
			if(count($data)) $url .= '?' . http_build_query($data);
535
			break;
536
		default:
537
			throw new Exception(__FUNCTION__.": Unknown/unimplemented method=$method!");
538
	}
539
	curl_setopt($c, CURLOPT_URL, $url);
540
541
	if (is_string($data)) $short_data = strlen($data) > 100 ? substr($data, 0, 100).' ...' : $data;

install-cli.php 1 location

@@ 382-400 (lines=19) @@
379
	curl_setopt($c, CURLOPT_TIMEOUT, 240);
380
	curl_setopt($c, CURLOPT_FOLLOWLOCATION, true);
381
382
	switch($method)
383
	{
384
		case 'POST':
385
			curl_setopt($c, CURLOPT_POST, true);
386
			if (is_array($data)) $data = json_encode($data, JSON_FORCE_OBJECT);
387
			curl_setopt($c, CURLOPT_POSTFIELDS, $data);
388
			break;
389
		case 'GET':
390
			if(count($data)) $url .= '?' . http_build_query($data);
391
			break;
392
		case 'FILE':
393
			curl_setopt($c, CURLOPT_HTTPHEADER, array("Content-type: $content_type"));
394
			curl_setopt($c, CURLOPT_POST, true);
395
			curl_setopt($c, CURLOPT_POSTFIELDS, file_get_contents($upload));
396
			if(count($data)) $url .= '?' . http_build_query($data);
397
			break;
398
		default:
399
			throw new Exception(__FUNCTION__.": Unknown/unimplemented method=$method!");
400
	}
401
	curl_setopt($c, CURLOPT_URL, $url);
402
403
	if (is_string($data)) $short_data = strlen($data) > 100 ? substr($data, 0, 100).' ...' : $data;