Code Duplication    Length = 12-15 lines in 2 locations

lib/private/legacy/template.php 1 location

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

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

@@ 636-650 (lines=15) @@
633
	 *
634
	 * @return string HTTP protocol. HTTP/2, HTTP/1.1 or HTTP/1.0.
635
	 */
636
	public function getHttpProtocol() {
637
		$claimedProtocol = strtoupper($this->server['SERVER_PROTOCOL']);
638
639
		$validProtocols = [
640
			'HTTP/1.0',
641
			'HTTP/1.1',
642
			'HTTP/2',
643
		];
644
645
		if(in_array($claimedProtocol, $validProtocols, true)) {
646
			return $claimedProtocol;
647
		}
648
649
		return 'HTTP/1.1';
650
	}
651
652
	/**
653
	 * Returns the request uri, even if the website uses one or more