Code Duplication    Length = 12-15 lines in 2 locations

lib/private/legacy/template.php 1 location

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

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

@@ 579-593 (lines=15) @@
576
	 *
577
	 * @return string HTTP protocol. HTTP/2, HTTP/1.1 or HTTP/1.0.
578
	 */
579
	public function getHttpProtocol() {
580
		$claimedProtocol = strtoupper($this->server['SERVER_PROTOCOL']);
581
582
		$validProtocols = [
583
			'HTTP/1.0',
584
			'HTTP/1.1',
585
			'HTTP/2',
586
		];
587
588
		if(in_array($claimedProtocol, $validProtocols, true)) {
589
			return $claimedProtocol;
590
		}
591
592
		return 'HTTP/1.1';
593
	}
594
595
	/**
596
	 * Returns the request uri, even if the website uses one or more