Code Duplication    Length = 12-15 lines in 2 locations

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

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

lib/private/legacy/template.php 1 location

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