protected static function getBrowserData($userAgent)
    {
        $matches = [];

        if (strpos($userAgent, 'Opera') !== false) {
            $browserName = 'Opera';
            preg_match_all('/Version\/([\d]+)/', $_SERVER['HTTP_USER_AGENT'], $matches);
        } elseif (strpos($userAgent, 'OPR/') !== false) {
            $browserName = 'Opera';
            preg_match_all('/OPR\/([\d]+)/', $_SERVER['HTTP_USER_AGENT'], $matches);
        } elseif (strpos($userAgent, 'Edge') !== false) {
            $browserName = 'Edge';
            preg_match_all('/Edge\/([\d]+)/', $_SERVER['HTTP_USER_AGENT'], $matches);
        } elseif (strpos($userAgent, 'Chrome') !== false) {
            $browserName = 'Chrome';
            preg_match_all('/Chrome\/([\d]+)/', $_SERVER['HTTP_USER_AGENT'], $matches);
        } elseif (strpos($userAgent, 'Safari') !== false) {
            $browserName = 'Safari';
            preg_match_all('/Version\/([\d]+)/', $_SERVER['HTTP_USER_AGENT'], $matches);
        } elseif (strpos($userAgent, 'Firefox') !== false) {
            $browserName = 'Firefox';
            preg_match_all('/Firefox\/([\d]+)/', $_SERVER['HTTP_USER_AGENT'], $matches);
        } elseif (strpos($userAgent, 'MSIE') !== false) {
            $browserName = 'IE';
            preg_match_all('/MSIE ([\d]+)/', $_SERVER['HTTP_USER_AGENT'], $matches);
        } elseif (strpos($userAgent, 'Trident/7') !== false) {
            $browserName = 'IE';
            preg_match_all('/rv:([\d]+)/', $_SERVER['HTTP_USER_AGENT'], $matches);
        } else {
            $browserName = 'unknown';
        }

        $version = isset($matches[1]) ? $matches[1][0] : 'unknown';

        return ['name' => $browserName, 'version' => $version];
    }