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

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