Code Duplication    Length = 12-15 lines in 2 locations

lib/private/legacy/template.php 1 location

@@ 396-407 (lines=12) @@
393
	 * @return string HTTP protocol. HTTP/2, HTTP/1.1 or HTTP/1.0.
394
	 * @internal Don't use this - use AppFramework\Http\Request->getHttpProtocol instead
395
	 */
396
	protected static function getHttpProtocol() {
397
		$claimedProtocol = strtoupper($_SERVER['SERVER_PROTOCOL']);
398
		$validProtocols = [
399
			'HTTP/1.0',
400
			'HTTP/1.1',
401
			'HTTP/2',
402
		];
403
		if(in_array($claimedProtocol, $validProtocols, true)) {
404
			return $claimedProtocol;
405
		}
406
		return 'HTTP/1.1';
407
	}
408
}
409

lib/private/AppFramework/Http/Request.php 1 location

@@ 591-605 (lines=15) @@
588
	 *
589
	 * @return string HTTP protocol. HTTP/2, HTTP/1.1 or HTTP/1.0.
590
	 */
591
	public function getHttpProtocol() {
592
		$claimedProtocol = strtoupper($this->server['SERVER_PROTOCOL']);
593
594
		$validProtocols = [
595
			'HTTP/1.0',
596
			'HTTP/1.1',
597
			'HTTP/2',
598
		];
599
600
		if(in_array($claimedProtocol, $validProtocols, true)) {
601
			return $claimedProtocol;
602
		}
603
604
		return 'HTTP/1.1';
605
	}
606
607
	/**
608
	 * Returns the request uri, even if the website uses one or more