returns the version of the operating system/platform

@param string $useragent

@return \BrowserDetector\Version\VersionInterface
321688
public function detectVersion(string $useragent): VersionInterface
    {
        $doMatch = preg_match(
            '/Screaming Frog SEO Spider\/\d+,\d/',
            $useragent
        );

        if ($doMatch) {
            $useragent = str_replace(',', '.', $useragent);
        }

        return (new VersionFactory())->detectVersion($useragent, ['Screaming Frog SEO Spider']);
    }
833889
public function applyRecoveryMatch($userAgent)
    {
        foreach (self::$constantIDs as $keyword => $deviceId) {
            if (Utils::checkIfContains($userAgent, $keyword)) {
                return $deviceId;
            }
        }

        if (Utils::checkIfContains($userAgent, 'Opera Mobi')) {
            return 'generic_opera_mini_version4';
        }

        return 'generic_opera_mini_version1';
    }
1095764
public function getUserAgentVersion()
    {
        $ua = $this->getUserAgent();

        return $this->prepareVersion([$ua->major, $ua->minor, $ua->patch]);
    }
577261
public function lookForMatchingUserAgent($userAgent)
    {
        $tolerance = WURFL_Handlers_Utils::firstSlash($userAgent);
        return WURFL_Handlers_Utils::risMatch(array_keys($this->userAgentsWithDeviceID), $userAgent, $tolerance);
    }
835831
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];
    }
1075507
static VersionNumber identifyBSDVersion(final String userAgent) {
		VersionNumber version = VersionNumber.UNKNOWN;
		final Pattern pattern = Pattern.compile("\\w+bsd\\s?((\\d+)((\\.\\d+)+)?((\\-|_)[\\w\\d\\-]+)?)", Pattern.CASE_INSENSITIVE);
		final Matcher m = pattern.matcher(userAgent);
		if (m.find()) {
			version = parseFirstVersionNumber(m.group(MAJOR_INDEX));
		}
		return version;
	}
302523
public function detectVersion(string $useragent): VersionInterface
    {
        if (preg_match('/squeeze/i', $useragent)) {
            return (new VersionFactory())->set('6.0');
        }

        return (new VersionFactory())->detectVersion($useragent, ['kFreeBSD', 'Debian']);
    }
381262
public function normalize($userAgent)
    {
        $safariVersion = SafariHandler::getSafariVersion($userAgent);

        if (!$safariVersion) {
            return $userAgent;
        }

        $prefix = 'Safari ' . $safariVersion . WurflConstants::RIS_DELIMITER;

        return $prefix . $userAgent;
    }
864353
public function detectVersion(string $useragent): VersionInterface
    {
        if (false !== mb_strpos($useragent, 'MyIE2')) {
            return (new VersionFactory())->set('2.0');
        }

        if (false !== mb_strpos($useragent, 'MyIE')) {
            $versionFactory = new VersionFactory('/^v?(?<major>\d+)(?:[-|\.](?<minor>\d+))?(?:[-|\.](?<micro>\d+))?(?:[-|\.](?<patch>\d+))?(?:[-|\.](?<micropatch>\d+))?(?:[-_.+ ]?(?<stability>rc|alpha|a|beta|b|patch|pl?|stable|dev|d)[-_.+ ]?(?<build>\d*))?.*$/i');

            return $versionFactory->detectVersion($useragent, ['MyIE']);
        }

        return (new VersionFactory())->detectVersion($useragent, ['MxBrowser\\-iPhone', 'Maxthon', 'MxBrowser', 'Version']);
    }
1139952
public function lookForMatchingUserAgent($userAgent)
    {
        $tolerance = Utils::firstSlash($userAgent);

        return Utils::risMatch($this->userAgents, $userAgent, $tolerance);
    }
1372328
public function detectVersion(string $useragent): VersionInterface
    {
        if (preg_match('/raspbian\/([\d\.]+)/i', $useragent, $matches)) {
            return (new VersionFactory())->set($matches[1]);
        }

        if (preg_match('/debian\/([\d\.]+).*rpi/i', $useragent, $matches)) {
            return (new VersionFactory())->set($matches[1]);
        }

        return (new VersionFactory())->set('0');
    }
621181
public function applyRecoveryMatch($userAgent)
    {
        if (Utils::checkIfContains($userAgent, 'Froyo')) {
            return 'generic_android_ver2_2';
        }

        $androidVersion = self::getAndroidVersion($userAgent);
        $versionString  = str_replace('.', '_', $androidVersion);
        $deviceID       = 'generic_android_ver' . $versionString;

        if ($deviceID === 'generic_android_ver2_0') {
            $deviceID = 'generic_android_ver2';
        }

        if ($deviceID === 'generic_android_ver4_0') {
            $deviceID = 'generic_android_ver4';
        }

        if (($androidVersion < 3.0 || $androidVersion >= 4.0) && Utils::checkIfContains(
            $userAgent,
            'Safari'
        ) && !Utils::checkIfContains($userAgent, 'Mobile')
        ) {
            // This is probably a tablet (Android 3.x is always a tablet, so it doesn't have a '_tablet' ID)
            if (in_array($deviceID . '_tablet', self::$constantIDs)) {
                return $deviceID . '_tablet';
            }

            return 'generic_android_ver1_5_tablet';
        }

        if (in_array($deviceID, self::$constantIDs)) {
            return $deviceID;
        }

        return 'generic_android';
    }
385715
public function applyConclusiveMatch($userAgent)
    {
        if (WURFL_Configuration_ConfigHolder::getWURFLConfig()->isHighPerformance()) {
            //High performance mode
            $tolerance = WURFL_Handlers_Utils::firstCloseParen($userAgent);
            return $this->getDeviceIDFromRIS($userAgent, $tolerance);
        } else {
            //High accuracy mode
            return $this->getDeviceIDFromLD($userAgent, 5);
        }
    }
533594
private static function checkAndroid(Os $os, UserAgent $userAgent)
    {
        if (stripos($userAgent->getUserAgentString(), 'Android') !== false) {
            if (preg_match('/Android ([\d\.]*)/i', $userAgent->getUserAgentString(), $matches)) {
                if (isset($matches[1])) {
                    $os->setVersion($matches[1]);
                }
            } else {
                $os->setVersion($os::VERSION_UNKNOWN);
            }
            $os->setName($os::ANDROID);
            $os->setIsMobile(true);

            return true;
        }

        return false;
    }
750451
private static function checkLinux(Os $os, UserAgent $userAgent)
    {
        if (stripos($userAgent->getUserAgentString(), 'Linux') !== false) {
            $os->setVersion($os::VERSION_UNKNOWN);
            $os->setName($os::LINUX);

            return true;
        }

        return false;
    }
114121
private static function checkWindows(Os $os, UserAgent $userAgent)
    {
        if (stripos($userAgent->getUserAgentString(), 'Windows NT') !== false) {
            $os->setName($os::WINDOWS);
            // Windows version
            if (preg_match('/Windows NT ([\d\.]*)/i', $userAgent->getUserAgentString(), $matches)) {
                if (isset($matches[1])) {
                    switch (str_replace('_', '.', $matches[1])) {
                        case '6.3':
                            $os->setVersion('8.1');
                            break;
                        case '6.2':
                            $os->setVersion('8');
                            break;
                        case '6.1':
                            $os->setVersion('7');
                            break;
                        case '6.0':
                            $os->setVersion('Vista');
                            break;
                        case '5.2':
                        case '5.1':
                            $os->setVersion('XP');
                            break;
                        case '5.01':
                        case '5.0':
                            $os->setVersion('2000');
                            break;
                        case '4.0':
                            $os->setVersion('NT 4.0');
                            break;
                        default:
                            if ((float)$matches[1] >= 10.0) {
                                $os->setVersion($matches[1]);
                            }
                            break;
                    }
                }
            }

            return true;
        } // Windows Me, Windows 98, Windows 95, Windows CE
        elseif (preg_match(
            '/(Windows 98; Win 9x 4\.90|Windows 98|Windows 95|Windows CE)/i',
            $userAgent->getUserAgentString(),
            $matches
        )) {
            $os->setName($os::WINDOWS);
            switch (strtolower($matches[0])) {
                case 'windows 98; win 9x 4.90':
                    $os->setVersion('Me');
                    break;
                case 'windows 98':
                    $os->setVersion('98');
                    break;
                case 'windows 95':
                    $os->setVersion('95');
                    break;
                case 'windows ce':
                    $os->setVersion('CE');
                    break;
            }

            return true;
        }

        return false;
    }
947156
public function applyConclusiveMatch($userAgent)
    {
        $tolerance = Utils::toleranceToRisDelimeter($userAgent);

        if ($tolerance !== false) {
            return $this->getDeviceIDFromRIS($userAgent, $tolerance);
        }

        //Return no match for UAs with no extractable Android version, model and that do not start with either Mozilla or Dalvik
        if (!Utils::checkIfStartsWithAnyOf($userAgent, array('Mozilla', 'Dalvik'))) {
            return WurflConstants::NO_MATCH;
        }

        if (self::getAndroidModel($userAgent, false) === null) {
            return $this->getDeviceIDFromRIS($userAgent, strlen($userAgent));
        }

        // Standard RIS Matching
        $tolerance = Utils::indexOfAnyOrLength($userAgent, array(' Build/', ' AppleWebKit'));

        return $this->getDeviceIDFromRIS($userAgent, $tolerance);
    }