Code Duplication    Length = 12-15 lines in 2 locations

lib/private/appframework/http/request.php 1 location

@@ 609-623 (lines=15) @@
606
	 *
607
	 * @return string HTTP protocol. HTTP/2, HTTP/1.1 or HTTP/1.0.
608
	 */
609
	public function getHttpProtocol() {
610
		$claimedProtocol = strtoupper($this->server['SERVER_PROTOCOL']);
611
612
		$validProtocols = [
613
			'HTTP/1.0',
614
			'HTTP/1.1',
615
			'HTTP/2',
616
		];
617
618
		if(in_array($claimedProtocol, $validProtocols, true)) {
619
			return $claimedProtocol;
620
		}
621
622
		return 'HTTP/1.1';
623
	}
624
625
	/**
626
	 * Returns the request uri, even if the website uses one or more

lib/private/template.php 1 location

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