Code Duplication    Length = 12-15 lines in 2 locations

lib/private/legacy/template.php 1 location

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

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

@@ 623-637 (lines=15) @@
620
	 *
621
	 * @return string HTTP protocol. HTTP/2, HTTP/1.1 or HTTP/1.0.
622
	 */
623
	public function getHttpProtocol() {
624
		$claimedProtocol = strtoupper($this->server['SERVER_PROTOCOL']);
625
626
		$validProtocols = [
627
			'HTTP/1.0',
628
			'HTTP/1.1',
629
			'HTTP/2',
630
		];
631
632
		if(in_array($claimedProtocol, $validProtocols, true)) {
633
			return $claimedProtocol;
634
		}
635
636
		return 'HTTP/1.1';
637
	}
638
639
	/**
640
	 * Returns the request uri, even if the website uses one or more