Code Duplication    Length = 12-15 lines in 2 locations

lib/private/legacy/template.php 1 location

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

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

@@ 665-679 (lines=15) @@
662
	 *
663
	 * @return string HTTP protocol. HTTP/2, HTTP/1.1 or HTTP/1.0.
664
	 */
665
	public function getHttpProtocol() {
666
		$claimedProtocol = strtoupper($this->server['SERVER_PROTOCOL']);
667
668
		$validProtocols = [
669
			'HTTP/1.0',
670
			'HTTP/1.1',
671
			'HTTP/2',
672
		];
673
674
		if(in_array($claimedProtocol, $validProtocols, true)) {
675
			return $claimedProtocol;
676
		}
677
678
		return 'HTTP/1.1';
679
	}
680
681
	/**
682
	 * Returns the request uri, even if the website uses one or more