Returns the base path of the request.

@return  object  A AnHttpUrl object
341901
public static function base()
    {
        if (! isset(self::$_base)) {
            // Get the base request path
            if (strpos(PHP_SAPI, 'cgi') !== false && !ini_get('cgi.fix_pathinfo')  && !empty($_SERVER['REQUEST_URI'])) {
                // PHP-CGI on Apache with "cgi.fix_pathinfo = 0"
                // We don't have user-supplied PATH_INFO in PHP_SELF
                $path = $_SERVER['PHP_SELF'];
            } else {
                $path = $_SERVER['SCRIPT_NAME'];
            }

            $path = rtrim(dirname($path), '/\\');

            // Sanitize the url since we can't trust the server var
            $path = AnService::get('anahita:filter.url')->sanitize($path);

            self::$_base = AnService::get('anahita:http.url', array('url' => $path));
        }

        return self::$_base;
    }
387460
public function getBasePath() : string
    {
        $baseUri = $this->getBase();
        $path = ltrim($this->getPath(), "/");

        $absoluteUri = $baseUri . (($path === "") ? "" : "/" . $path);

        return $absoluteUri;
    }
1303880
public function getBaseUrl()
    {
        if ($this->external == false) {
            return $this->baseUrl = Url::getBase();
        }

        return $this->baseUrl;
    }
211315
private function getCurrentUrlPath()
    {
        if ($this->path) {
            return $this->path;
        }

        /**
         * check if the path is empty otherwise
         * set it with the server variable and if there's no server variable set it as the default delimiter [/] the root
         */
        $this->path = !empty($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : null;
        $this->urlPart = $this->parsePath($this->path);

        return $this->path;
    }
332673
public function getBasePath()
    {
        //
        if ($this->resolvePath && $this->resolvePath instanceof \Closure) {
            $pathHandler = $this->resolvePath;
            $this->basePath = $pathHandler($this->basePath);
        }

        return $this->basePath;
    }
1361440
public function basePath()
    {
        if ($this->base_path === false) {
            if ($base_path = Rails::application()->config()->base_path)
                $this->base_path = '/' . $base_path;
            elseif (($base_path = $this->detectBasePath()) && $base_path != '/')
                $this->base_path = $base_path;
            else
                $this->base_path = null;
        }
        return $this->base_path;
    }
64569
public function getBasePath() {
    	
    	return ((isset($this->config['General']['base_path']) 
            && $this->config['General']['base_path'] 
            && isset($this->config['General']['use_base_path']) 
            && $this->config['General']['use_base_path']) 
                ? $this->config['General']['base_path'] : null);
    }
670790
public function getBasePath(): string
	{
		if($this->basePath === null)
		{
			$path = $this->server->get('SCRIPT_NAME');

			$this->basePath = rtrim(str_replace(basename($path), '', $path), '/');
		}

		return $this->basePath;
	}
365910
public static function getBaseUrl()
    {
        $protocol = isset($_SERVER['HTTPS']) ? 'https' : 'http';
        $url = $protocol . '://' . $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'] . $_SERVER['REQUEST_URI'];

        // cut at last '/' (we dont want to see index.php)
        return substr($url, 0, strrpos($url, '/'));
    }
805108
public function getUrl()
    {
        $proto = $this->getUrlProto();
        $host = $this->getUrlHost();
        $port = $this->getUrlPort($proto);
        

        $url = $proto . '://' . $host;
        if (($proto == 'https' && $port != 443) || ($proto == 'http' && $port != 80)) {
            $url .= ':' . $port;
        }

        if (isset($_SERVER)) {
            $path = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '/';
            $url .= $path;
        }

        if ($host == 'unknown') {
            $url = null;
        }

        return $url;
    }
686315
public function getUrl()
    {
        if ($this->findDocumentRootInScriptFileName() === $this->removeLastSlash($this->root)) {
            return $this->getRequestUri();
        }
        $path = $this->server->get('PATH_INFO');

        return $path;
    }
1289222
public function getBaseUrl() {
    if ($pos = strpos($this->url, '?')) {
      return substr($this->url, 0, $pos);
    }
    return $this->url;
  }
115603
public function getBaseUri()
    {
        return sprintf('%s%s'
            , $this->params['endpoint']
            , ! empty($this->id) ? '/' . $this->id : null
        );
    }
1290614
protected function getPath()
    {
        $path = $this->input->getOption('path');

        if (! is_null($path)) {
            return $this->container['path.base'] .DS .$path;
        }
    }
563953
function getBaseUrl()
    {
        $filename       = $this->getServer()->get('SCRIPT_FILENAME', '');
        $scriptName     = $this->getServer()->get('SCRIPT_NAME');
        $phpSelf        = $this->getServer()->get('PHP_SELF');
        $origScriptName = $this->getServer()->get('ORIG_SCRIPT_NAME', false);

        if ($scriptName !== null && basename($scriptName) === $filename) {
            $baseUrl = $scriptName;
        } elseif ($phpSelf !== null && basename($phpSelf) === $filename) {
            $baseUrl = $phpSelf;
        } elseif ($origScriptName !== null && basename($origScriptName) === $filename) {
            // 1and1 shared hosting compatibility.
            $baseUrl = $origScriptName;
        } else {
            // Backtrack up the SCRIPT_FILENAME to find the portion
            // matching PHP_SELF.

            $baseUrl  = '/';
            $basename = basename($filename);
            if ($basename) {
                $path     = ($phpSelf ? trim($phpSelf, '/') : '');
                $baseUrl .= substr($path, 0, strpos($path, $basename)) . $basename;
            }
        }

        // Does the base URL have anything in common with the request URI?
        $requestUri = $this->getMessageObject()->getTarget();

        // Full base URL matches.
        if (0 === strpos($requestUri, $baseUrl))
            return $baseUrl;

        // Directory portion of base path matches.
        $baseDir = str_replace('\\', '/', dirname($baseUrl));
        if (0 === strpos($requestUri, $baseDir))
            return $baseDir;

        $truncatedRequestUri = $requestUri;

        if (false !== ($pos = strpos($requestUri, '?')))
            $truncatedRequestUri = substr($requestUri, 0, $pos);

        $basename = basename($baseUrl);

        // No match whatsoever
        if (empty($basename) || false === strpos($truncatedRequestUri, $basename))
            return '';

        // If using mod_rewrite or ISAPI_Rewrite strip the script filename
        // out of the base path. $pos !== 0 makes sure it is not matching a
        // value from PATH_INFO or QUERY_STRING.
        if (strlen($requestUri) >= strlen($baseUrl)
            && (false !== ($pos = strpos($requestUri, $baseUrl)) && $pos !== 0)
        ) {
            $baseUrl = substr($requestUri, 0, $pos + strlen($baseUrl));
        }

        return $baseUrl;
    }
212724
public function baseURL() {
		if($this->api_is_https) {
			$url = 'https://' . $this->api_host . ($this->api_port != 443?':'.$this->api_port:'');
		} else {
			$url = 'http://' . $this->api_host . ($this->api_port != 80?':'.$this->api_port:'');
		}
		return $url;
	}
883651
public function baseUrl()
    {
        if (isset($this->baseUrl)) {
            return $this->baseUrl;
        }

        $config = $this->getPackageConfig();

        if (isset($config['baseUrl'])) {
            return $config['baseUrl'];
        }

        return 'http://localhost:8888';
    }