Code Duplication    Length = 12-15 lines in 2 locations

lib/private/appframework/http/request.php 1 location

@@ 556-570 (lines=15) @@
553
	 *
554
	 * @return string HTTP protocol. HTTP/2, HTTP/1.1 or HTTP/1.0.
555
	 */
556
	public function getHttpProtocol() {
557
		$claimedProtocol = strtoupper($this->server['SERVER_PROTOCOL']);
558
559
		$validProtocols = [
560
			'HTTP/1.0',
561
			'HTTP/1.1',
562
			'HTTP/2',
563
		];
564
565
		if(in_array($claimedProtocol, $validProtocols, true)) {
566
			return $claimedProtocol;
567
		}
568
569
		return 'HTTP/1.1';
570
	}
571
572
	/**
573
	 * Returns the request uri, even if the website uses one or more

lib/private/template.php 1 location

@@ 363-374 (lines=12) @@
360
	 * @return string HTTP protocol. HTTP/2, HTTP/1.1 or HTTP/1.0.
361
	 * @internal Don't use this - use AppFramework\Http\Request->getHttpProtocol instead
362
	 */
363
	protected static function getHttpProtocol() {
364
		$claimedProtocol = strtoupper($_SERVER['SERVER_PROTOCOL']);
365
		$validProtocols = [
366
			'HTTP/1.0',
367
			'HTTP/1.1',
368
			'HTTP/2',
369
		];
370
		if(in_array($claimedProtocol, $validProtocols, true)) {
371
			return $claimedProtocol;
372
		}
373
		return 'HTTP/1.1';
374
	}
375
376
	/**
377
	 * @return bool