public static function getSiteUrl()
    {
        if (!self::hasServerVariable('HTTP_HOST')) {
            return null;
        }
        
        $protocol = (self::looksLikeHttps()) ? 'https' : 'http';
        $port = self::getServerVariable('SERVER_PORT', 80);
        
        list ($host) = explode(':', self::getServerVariable('HTTP_HOST'));
        
        if (!in_array($port, [
            80,
            443
        ]) || ($protocol != 'https' && $port == 443)) {
            $host .= ':' . $port;
        }
        
        $fullUrl = $protocol . '://' . $host . '/';
        if (USE_INDEX_FILE) {
            $fullUrl .= 'index.php/';
        }
        
        return $fullUrl;
    }