src/util/URL.php
public static function base($protocol = null): string {
        if ($protocol === null) {
            return \Mii::$app->base_url;
        }

        if ($protocol === TRUE) {
            return \Mii::$app->request->get_hostname() . \Mii::$app->base_url;
        }

        if ($protocol !== '//')
            $protocol = $protocol . '://';

        $domain = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : $_SERVER['SERVER_NAME'];


        return $protocol . $domain . \Mii::$app->base_url;
    }
public static function base($protocol = null): string {
        if ($protocol === null) {
            return \Mii::$app->base_url;
        }

        if ($protocol === TRUE) {
            return \Mii::$app->request->get_hostname() . \Mii::$app->base_url;
        }

        if ($protocol !== '//')
            $protocol = $protocol . '://';

        $domain = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : $_SERVER['SERVER_NAME'];


        return $protocol . $domain . \Mii::$app->base_url;
    }
Gets the base URL to the application.
To specify a protocol, provide the protocol as a string or request object.
If a protocol is used, a complete URL will be generated using the
`$_SERVER['HTTP_HOST']` variable.

// Absolute URL path with no host or protocol
echo URL::base();

// Absolute URL path with host, https protocol
echo URL::base('https');

// Absolute URL path with '//'
echo URL::base('//');

@param   mixed $protocol Protocol string or boolean
@return  string