public function getCurrentUrl($asUrlObject = false)
{
if ($this->currentUrl == '') {
// schema
$pageURL = 'http';
if ($this->isRequestSecured()) {
$pageURL = 'https';
}
$pageURL .= "://";
// port, server name and request uri
$host = $this->getHostName();
$port = $this->getConnectionPort();
if ($port && $port != '80' && $port != '443') {
$pageURL .= $host . ":" . $port . $this->server()->requestUri();
} else {
$pageURL .= $host . $this->server()->requestUri();
}
// query
$query = $this->server()->queryString();
if ($query && strpos($pageURL, '?') === false) {
$pageURL .= '?' . $query;
}
$this->currentUrl = $pageURL;
}
if ($asUrlObject) {
return $this->url($this->currentUrl);
} else {
return $this->currentUrl;
}
}