getHost(); if (strlen($host) > 0) { $userInfo = $this->getUserInfo(); $port = $this->getPort(); return (strlen($userInfo) ? $userInfo."@" : "").$host.(!is_null($port) ? ":".$port : ""); } return ""; } public function getFragment() { return $this->fragment ?? ""; } public function getHost() { return $this->host ?? ""; } public function getPath() { return $this->path ?? ""; } public function getPort() { return $this->port; } public function getQuery() { return $this->query ?? ""; } public function getScheme() { return $this->scheme ?? ""; } public function getUserInfo() { if (strlen($this->user ?? "")) { return $this->user.(strlen($this->pass ?? "") ? ":".$this->pass : ""); } return ""; } public function withFragment($fragment) { $out = clone $this; $out->set("fragment", $fragment); return $out; } public function withHost($host) { if ($host === "") { $host = null; } $out = clone $this; $out->set("host", $host); return $out; } public function withPath($path) { $out = clone $this; $out->set("path", $path); return $out; } public function withPort($port) { $out = clone $this; $out->set("port", $port); return $out; } public function withQuery($query) { $out = clone $this; $out->set("query", $query); return $out; } public function withScheme($scheme) { $out = clone $this; $out->set("scheme", $scheme); return $out; } public function withUserInfo($user, $password = null) { $out = clone $this; $out->set("user", $user); $out->set("pass", $password); return $out; } public function __get(string $name) { return $this->$name; } }