in src/parser/PhutilURI.php [144:206]
public function __toString() {
$prefix = null;
if ($this->isGitURI()) {
$port = null;
} else {
$port = $this->port;
}
$domain = $this->domain;
$user = $this->user;
$pass = $this->pass;
if (strlen($user) && strlen($pass)) {
$auth = rawurlencode($user).':'.rawurlencode($pass).'@';
} else if (strlen($user)) {
$auth = rawurlencode($user).'@';
} else {
$auth = null;
}
$protocol = $this->protocol;
if ($this->isGitURI()) {
$protocol = null;
} else {
if (strlen($auth)) {
$protocol = nonempty($this->protocol, 'http');
}
}
if (strlen($protocol) || strlen($auth) || strlen($domain)) {
if ($this->isGitURI()) {
$prefix = "{$auth}{$domain}";
} else {
$prefix = "{$protocol}://{$auth}{$domain}";
}
if (strlen($port)) {
$prefix .= ':'.$port;
}
}
if ($this->query) {
$query = '?'.phutil_build_http_querystring_from_pairs($this->query);
} else {
$query = null;
}
if (strlen($this->getFragment())) {
$fragment = '#'.$this->getFragment();
} else {
$fragment = null;
}
$path = $this->getPath();
if ($this->isGitURI()) {
if (strlen($path)) {
$path = ':'.$path;
}
}
return $prefix.$path.$query.$fragment;
}