private static function getBaseUrl(): ?string
    {
        $serverName = filter_input(
            \INPUT_SERVER,
            'SERVER_NAME',
            \FILTER_SANITIZE_STRING
        );
        if (!empty($serverName)) {
            $https = filter_input(\INPUT_SERVER, 'HTTPS', \FILTER_SANITIZE_STRING);
            $protocol = !empty($https) && strtolower($https) === 'on' ? 'https'
                : 'http';
            return $protocol.'://'.$serverName;
        }
        return null;
    }