public function getCurrentURI($subpath = '')
    {
        static $uri;

        if (! $uri) {
            $uri = (\MUtil_Https::on() || $this->project->isHttpsRequired()) ? 'https' : 'http';

            $uri .= '://';
            $uri .= isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : $this->project->getConsoleUrl();
            $uri .= $this->basepath->getBasePath();
        }
        if ($subpath && ($subpath[0] != '/')) {
            $subpath = '/' . $subpath;
        }

        return $uri . $subpath;
    }