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

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