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

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