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

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