Code Duplication    Length = 12-15 lines in 2 locations

lib/private/legacy/template.php 1 location

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

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