public function getUrl($name, $includeBasePath = true)
    {
        if ($this->callerNotSelfOrPathsProxy()) {
            Deprecated::method(3.3, 'Use UrlGenerator or Asset Packages instead.');
        }

        if (($name === 'canonical' || $name === 'canonicalurl') && isset($this->app['canonical'])) {
            if ($url = $this->app['canonical']->getUrl()) {
                return $url;
            }
        }

        if (!$this->requestInitialized && $this->app) {
            $this->initializeRequest($this->app, $this->requestObject);
        }

        if (!$this->configInitialized && in_array($name, ['theme', 'bolt', 'templates', 'templatespath'])) {
            $this->initializeConfig();
        }

        if (array_key_exists($name . 'url', $this->urls) && $name !== 'root') {
            return $this->urls[$name . 'url'];
        }
        if (! array_key_exists($name, $this->urls)) {
            throw new \InvalidArgumentException("Requested url $name is not available", 1);
        }

        $url = $this->urls[$name];

        if (!$includeBasePath || strpos($url, 'http') === 0 || strpos($url, '//') === 0) {
            return $url;
        }

        return $this->urlPrefix . $url;
    }