Code Duplication    Length = 12-15 lines in 2 locations

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

@@ 586-600 (lines=15) @@
583
	 *
584
	 * @return string HTTP protocol. HTTP/2, HTTP/1.1 or HTTP/1.0.
585
	 */
586
	public function getHttpProtocol() {
587
		$claimedProtocol = \strtoupper($this->server['SERVER_PROTOCOL']);
588
589
		$validProtocols = [
590
			'HTTP/1.0',
591
			'HTTP/1.1',
592
			'HTTP/2',
593
		];
594
595
		if (\in_array($claimedProtocol, $validProtocols, true)) {
596
			return $claimedProtocol;
597
		}
598
599
		return 'HTTP/1.1';
600
	}
601
602
	/**
603
	 * Returns the request uri, even if the website uses one or more

lib/private/legacy/template.php 1 location

@@ 406-417 (lines=12) @@
403
	 * @return string HTTP protocol. HTTP/2, HTTP/1.1 or HTTP/1.0.
404
	 * @internal Don't use this - use AppFramework\Http\Request->getHttpProtocol instead
405
	 */
406
	protected static function getHttpProtocol() {
407
		$claimedProtocol = \strtoupper($_SERVER['SERVER_PROTOCOL']);
408
		$validProtocols = [
409
			'HTTP/1.0',
410
			'HTTP/1.1',
411
			'HTTP/2',
412
		];
413
		if (\in_array($claimedProtocol, $validProtocols, true)) {
414
			return $claimedProtocol;
415
		}
416
		return 'HTTP/1.1';
417
	}
418
}
419