Code Duplication    Length = 12-15 lines in 2 locations

lib/private/legacy/template.php 1 location

@@ 376-387 (lines=12) @@
373
	 * @return string HTTP protocol. HTTP/2, HTTP/1.1 or HTTP/1.0.
374
	 * @internal Don't use this - use AppFramework\Http\Request->getHttpProtocol instead
375
	 */
376
	protected static function getHttpProtocol() {
377
		$claimedProtocol = strtoupper($_SERVER['SERVER_PROTOCOL']);
378
		$validProtocols = [
379
			'HTTP/1.0',
380
			'HTTP/1.1',
381
			'HTTP/2',
382
		];
383
		if(in_array($claimedProtocol, $validProtocols, true)) {
384
			return $claimedProtocol;
385
		}
386
		return 'HTTP/1.1';
387
	}
388
}
389

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

@@ 674-688 (lines=15) @@
671
	 *
672
	 * @return string HTTP protocol. HTTP/2, HTTP/1.1 or HTTP/1.0.
673
	 */
674
	public function getHttpProtocol() {
675
		$claimedProtocol = strtoupper($this->server['SERVER_PROTOCOL']);
676
677
		$validProtocols = [
678
			'HTTP/1.0',
679
			'HTTP/1.1',
680
			'HTTP/2',
681
		];
682
683
		if(in_array($claimedProtocol, $validProtocols, true)) {
684
			return $claimedProtocol;
685
		}
686
687
		return 'HTTP/1.1';
688
	}
689
690
	/**
691
	 * Returns the request uri, even if the website uses one or more