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

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