Code Duplication    Length = 12-15 lines in 2 locations

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

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

lib/private/legacy/template.php 1 location

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