src/Router.php
private function autodetect_host() {
		if ($this->host !== null)
			return;
		$proto = isset($_SERVER['HTTPS']) && !empty($_SERVER['HTTPS'])
			? 'https://' : 'http://';
		$host = isset($_SERVER['SERVER_NAME'])
			? $_SERVER['HTTP_HOST'] : 'localhost';
		$port = isset($_SERVER['SERVER_PORT'])
			? (int)$_SERVER['SERVER_PORT'] : null;
		// @codeCoverageIgnoreStart
		$port = $this->verify_port($port, $proto);
		if ($port && (strpos($host, ':') === false))
			$host .= ':' . $port;
		// @codeCoverageIgnoreEnd
		$host = str_replace([':80', ':443'], '', $host);
		$this->host = $proto . $host . $this->home;
	}
private function autodetect_host() {
		if ($this->host !== null)
			return;
		$proto = isset($_SERVER['HTTPS']) && !empty($_SERVER['HTTPS'])
			? 'https://' : 'http://';
		$host = isset($_SERVER['SERVER_NAME'])
			? $_SERVER['HTTP_HOST'] : 'localhost';
		$port = isset($_SERVER['SERVER_PORT'])
			? (int)$_SERVER['SERVER_PORT'] : null;
		// @codeCoverageIgnoreStart
		$port = $this->verify_port($port, $proto);
		if ($port && (strpos($host, ':') === false))
			$host .= ':' . $port;
		// @codeCoverageIgnoreEnd
		$host = str_replace([':80', ':443'], '', $host);
		$this->host = $proto . $host . $this->home;
	}
private function autodetect_host ( ) { if ( $ this -> host !== null ) return ; $ proto = isset ( $ _SERVER [ 'HTTPS' ] ) && ! empty ( $ _SERVER [ 'HTTPS' ] ) ? 'https://' : 'http://' ; $ host = isset ( $ _SERVER [ 'SERVER_NAME' ] ) ? $ _SERVER [ 'HTTP_HOST' ] : 'localhost' ; $ port = isset ( $ _SERVER [ 'SERVER_PORT' ] ) ? ( int ) $ _SERVER [ 'SERVER_PORT' ] : null ; // @codeCoverageIgnoreStart $ port = $ this -> verify_port ( $ port , $ proto ) ; if ( $ port && ( strpos ( $ host , ':' ) === false ) ) $ host .= ':' . $ port ; // @codeCoverageIgnoreEnd $ host = str_replace ( [ ':80' , ':443' ] , '' , $ host ) ; $ this -> host = $ proto . $ host . $ this -> home ; }
Autodetect host.

Naive host detection. This relies on super-global $_SERVER
variable which varies from one web server to another, and
especially inaccurate when aliasing or reverse-proxying is
involved, in which case, manual config should be used.
Autodetect host .