maps the version of the operating system

@param string|null $engineVersion

@return \BrowserDetector\Version\VersionInterface
499981
public function mapEngineVersion(?string $engineVersion): VersionInterface
    {
        if (null === $engineVersion) {
            return new Version();
        }

        switch (mb_strtolower($engineVersion)) {
            case '':
            case 'unknown':
            case 'other':
                return new Version(0);
                break;
            default:
                // nothing to do here
                break;
        }

        return (new VersionFactory())->set($engineVersion);
    }
495370
public function getOneVersion($versionNumber, $con = null)
    {
        return ChildDealerVersionQuery::create()
            ->filterByDealer($this)
            ->filterByVersion($versionNumber)
            ->findOne($con);
    }
1016631
public function detectVersion(string $useragent): VersionInterface
    {
        $doMatch = preg_match('/CPU like Mac OS X/', $useragent);

        if ($doMatch) {
            return (new VersionFactory())->set('1.0');
        }

        $doMatch = preg_match('/mobile\/(\d+[A-Z]\d+(?:[a-z])?)/i', $useragent, $matches);

        if ($doMatch) {
            $buildVersion = iOSbuild::getVersion($matches[1]);

            if (false !== $buildVersion) {
                return (new VersionFactory())->set($buildVersion);
            }
        }

        $doMatch = preg_match('/applecoremedia\/\d+\.\d+\.\d+\.(\d+[A-Z]\d+(?:[a-z])?)/i', $useragent, $matches);

        if ($doMatch) {
            $buildVersion = iOSbuild::getVersion($matches[1]);

            if (false !== $buildVersion) {
                return (new VersionFactory())->set($buildVersion);
            }
        }

        if (false !== mb_stripos($useragent, 'darwin')) {
            $searches = [
                '/darwin\/18\.2/i' => '12.2',
                '/darwin\/18\.1/i' => '12.1',
                '/darwin\/18/i' => '12.0',
                '/darwin\/17\.7/i' => '11.4',
                '/darwin\/17\.6/i' => '11.4',
                '/cfnetwork\/897(\.\d+)? darwin\/17\.5/i' => '11.3',
                '/darwin\/17\.4/i' => '11.2',
                '/darwin\/17\.3/i' => '11.2',
                '/darwin\/17\.2/i' => '11.1',
                '/darwin\/17/i' => '11.0',
                '/darwin\/16\.7/i' => '10.3.3',
                '/darwin\/16\.6/i' => '10.3.2',
                '/darwin\/16\.5/i' => '10.3',
                '/darwin\/16\.3/i' => '10.2',
                '/darwin\/16\.1/i' => '10.1',
                '/darwin\/16/i' => '10.0',
                '/darwin\/15\.6/i' => '9.3.3',
                '/darwin\/15\.5/i' => '9.3.2',
                '/darwin\/15\.4/i' => '9.3',
                '/cfnetwork\/758\.3(\.\d+)? darwin\/15/i' => '9.3',
                '/cfnetwork\/758\.2(\.\d+)? darwin\/15/i' => '9.2',
                '/cfnetwork\/758\.1(\.\d+)? darwin\/15/i' => '9.1',
                '/darwin\/15/i' => '9.0',
                '/cfnetwork\/711\.[45](\.\d+)? darwin\/14/i' => '8.4',
                '/cfnetwork\/711\.3(\.\d+)? darwin\/14/i' => '8.3',
                '/cfnetwork\/711\.2(\.\d+)? darwin\/14/i' => '8.2',
                '/cfnetwork\/711\.1(\.\d+)? darwin\/14/i' => '8.1',
                '/cfnetwork\/711([\.\d]+)? darwin\/14/i' => '8.0',
                '/cfnetwork\/709(\.\d+)? darwin\/14/i' => '8.0',
                '/cfnetwork\/672\.1(\.\d+)? darwin\/14/i' => '7.1',
                '/darwin\/14/i' => '7.0',
                '/cfnetwork\/609\.1(\.\d+)? darwin\/13/i' => '6.1',
                '/darwin\/13/i' => '6.0',
                '/cfnetwork\/548\.1(\.\d+)? darwin\/11/i' => '5.1',
                '/cfnetwork\/548([\.\d]+)? darwin\/11/i' => '5.0',
                '/darwin\/11/i' => '4.3',
                '/darwin\/10\.4/i' => '4.2',
                '/cfnetwork\/485\.10(\.\d+)? darwin\/10\.3/i' => '4.1',
                '/cfnetwork\/485\.2(\.\d+)? darwin\/10\.3/i' => '4.0',
                '/darwin\/10\.3/i' => '3.2',
                '/cfnetwork\/459 darwin\/10/i' => '3.1',
                '/darwin\/10/i' => '3.0',
                '/darwin\/9\.4/i' => '2.1',
                '/darwin\/9\.3/i' => '2.0',
                '/darwin\/9/i' => '1.0',
            ];

            foreach ($searches as $rule => $version) {
                if (preg_match($rule, $useragent)) {
                    return (new VersionFactory())->set($version);
                }
            }
        }

        $doMatch = preg_match('/^apple-(?:iphone|ip[ao]d)\d+[c,_]\d+\/([\d\.]+)$/i', $useragent, $matches);

        if ($doMatch) {
            // @see https://justworks.ca/blog/ios-and
            $map = [
                '508.11' => '2.2.1',
                '701.341' => '3.0',
                '701.400' => '3.0.1',
                '703.144' => '3.1',
                '704.11' => '3.1.2',
                '705.18' => '3.1.3',
                '702.367' => '3.2',
                '702.405' => '3.2.1',
                '702.500' => '3.2.2',
                '801.293' => '4.0',
                '801.306' => '4.0.1',
                '801.400' => '4.0.2',
                '802.117' => '4.1',
                '802.118' => '4.1',
                '803.148' => '4.2.1',
                '803.14800001' => '4.2.1',
                '805.128' => '4.2.5',
                '805.200' => '4.2.6',
                '805.303' => '4.2.7',
                '805.401' => '4.2.8',
                '805.501' => '4.2.9',
                '805.600' => '4.2.10',
                '806.190' => '4.3',
                '806.191' => '4.3',
                '807.4' => '4.3.1',
                '808.7' => '4.3.2',
                '808.8' => '4.3.2',
                '810.2' => '4.3.3',
                '810.3' => '4.3.3',
                '811.2' => '4.3.4',
                '812.1' => '4.3.5',
                '901.334' => '5.0',
                '901.40' => '5.0.1',
                '902.17' => '5.1',
                '902.206' => '5.1.1',
                '1001.40' => '6.0',
                '1001.52' => '6.0.1',
                '1002.14' => '6.1',
                '1002.146' => '6.1.2',
                '1002.329' => '6.1.3',
                '1002.350' => '6.1.3',
                '1101.465' => '7.0',
                '1101.470' => '7.0.1',
                '1101.47000001' => '7.0.1',
                '1101.501' => '7.0.2',
                '1102.511' => '7.0.3',
                '1102.55400001' => '7.0.4',
                '1102.601' => '7.0.5',
                '1102.651' => '7.0.6',
                '1104.167' => '7.1',
                '1104.169' => '7.1',
                '1104.201' => '7.1.1',
                '1104.257' => '7.1.2',
                '1201.365' => '8.0',
                '1201.366' => '8.0.1',
                '1201.405' => '8.0.2',
                '1202.410' => '8.1',
                '1202.411' => '8.1',
                '1202.435' => '8.1.1',
                '1202.436' => '8.1.1',
                '1202.440' => '8.1.2',
                '1202.445' => '8.1.2',
                '1202.466' => '8.1.3',
                '1204.508' => '8.2',
                '1206.69' => '8.3',
                '1208.143' => '8.4',
                '1208.321' => '8.4.1',
                '1301.342' => '9.0',
                '1301.344' => '9.0',
                '1301.402' => '9.0.1',
                '1301.404' => '9.0.1',
                '1301.452' => '9.0.2',
                '1302.143' => '9.1',
                '1303.075' => '9.2',
                '1304.15' => '9.2.1',
                '1305.234' => '9.3',
                '1305.328' => '9.3.1',
                '1306.69' => '9.3.2',
                '1306.72' => '9.3.2',
                '1307.34' => '9.3.3',
                '1307.35' => '9.3.4',
                '1307.36' => '9.3.5',
                '1401.403' => '10.0.1',
                '1401.456' => '10.0.2',
                '1402.72' => '10.1',
                '1402.100' => '10.1.1',
                '1403.92' => '10.2',
                '1404.27' => '10.2.1',
                '1405.277' => '10.3',
                '1405.304' => '10.3.1',
                '1406.89' => '10.3.2',
                '1406.8089' => '10.3.2',
                '1407.60' => '10.3.3',
                '1501.372' => '11.0',
                '1501.402' => '11.0.1',
                '1501.421' => '11.0.2',
                '1501.432' => '11.0.3',
                '1502.93' => '11.1',
                '1502.150' => '11.1.1',
                '1502.202' => '11.1.2',
                '1503.114' => '11.2',
                '1503.153' => '11.2.1',
                '1503.202' => '11.2.2',
                '1504.60' => '11.2.5',
                '1504.100' => '11.2.6',
                '1505.216' => '11.3',
                '1505.302' => '11.3.1',
                '1506.79' => '11.4',
                '1507.77' => '11.4.1',
                '1601.366' => '12.0',
                '1601.405' => '12.0.1',
                '1602.92' => '12.1',
                '1603.50' => '12.1.1',
            ];

            if (isset($map[$matches[1]])) {
                return (new VersionFactory())->set($map[$matches[1]]);
            }
        }

        $searches = [
            'IphoneOSX',
            'CPU OS_?',
            'CPU iOS',
            'CPU iPad OS',
            'iPhone OS\;FBSV',
            'iPhone OS',
            'iPhone_OS',
            'IUC\(U\;iOS',
            'iPh OS',
            'iosv',
            'iPad\/',
            'iOS',
        ];

        $detectedVersion = (new VersionFactory())->detectVersion($useragent, $searches);

        if ('10.10' === $detectedVersion->getVersion(VersionInterface::IGNORE_MICRO)) {
            return (new VersionFactory())->set('8.0.0');
        }

        return $detectedVersion;
    }
614550
public function mapPlatformKey(?string $osVersion, ?string $platform = null): ?string
    {
        if (null === $osVersion) {
            return 'unknown';
        }

        switch (mb_strtolower($osVersion)) {
            case '':
            case 'unknown':
            case 'other':
                return 'unknown';
                break;
            case 'server 2003':
                return 'windows 2003';
                break;
            case 'nt 5.1':
                return 'windows nt 5.1';
                break;
            case 'nt 5.2':
                return 'windows nt 5.2';
                break;
            case 'nt 5.3':
                return 'windows nt 5.3';
                break;
            case 'nt 6.0':
                return 'windows nt 6.0';
                break;
            case 'nt 6.1':
                return 'windows nt 6.1';
                break;
            case 'nt 6.2':
                return 'windows nt 6.2';
                break;
            case 'nt 6.3':
                return 'windows nt 6.3';
                break;
            default:
                // nothing to do here
                break;
        }

        if (null === $platform) {
            return 'unknown';
        }

        switch (mb_strtolower($platform)) {
            case '':
            case 'unknown':
            case 'other':
                return 'unknown';
                break;
            case 'winxp':
            case 'windows xp':
                switch (mb_strtolower($osVersion)) {
                    case '5.1':
                        return 'windows nt 5.1';
                        break;
                    case '5.2':
                        return 'windows nt 5.2';
                        break;
                    default:
                        // do nothing
                }

                return 'windows nt 5.1';
                break;
            case 'win7':
            case 'windows 7':
                return 'windows nt 6.1';
                break;
            case 'win8':
            case 'windows 8':
                return 'windows nt 6.2';
                break;
            case 'win8.1':
            case 'windows 8.1':
                return 'windows nt 6.3';
                break;
            case 'winvista':
            case 'windows vista':
                return 'windows nt 6.0';
                break;
            case 'win2003':
                return 'windows 2003';
                break;
            case 'win98':
            case 'windows 98':
                return 'windows 98';
                break;
            case 'win95':
                return 'windows 95';
                break;
            case 'win2000':
            case 'windows 2000':
                switch (mb_strtolower($osVersion)) {
                    case '5.01':
                        return 'windows nt 5.01';
                        break;
                    case '5.0':
                        return 'windows nt 5.0';
                        break;
                    default:
                        // do nothing
                }

                return 'windows nt 5.0';
                break;
            case 'winme':
                return 'windows me';
                break;
            case 'win9':
            case 'win10':
            case 'windows 10':
                switch (mb_strtolower($osVersion)) {
                    case '6.4':
                        return 'windows nt 6.4';
                        break;
                    case '10.0':
                        return 'windows nt 10.0';
                        break;
                    default:
                        // do nothing
                }

                return 'windows nt 10.0';
                break;
            case 'win31':
                if ('3.11' === mb_strtolower($osVersion)) {
                    return 'windows 3.11';
                }

                return 'windows 3.1';
                break;
            case 'wince':
                return 'windows ce';
                break;
            case 'winnt':
                switch (mb_strtolower($osVersion)) {
                    case '3.1':
                        return 'windows nt 3.1';
                        break;
                    case '3.5':
                        return 'windows nt 3.5';
                        break;
                    case '4.0':
                        return 'windows nt 4.0';
                        break;
                    case '4.1':
                        return 'windows nt 4.1';
                        break;
                    default:
                        // do nothing
                }

                return 'windows nt';
                break;
            case 'winrt8':
                return 'windows nt 6.2; arm';
                break;
            case 'winrt8.1':
                return 'windows nt 6.3; arm';
                break;
            case 'winphone':
            case 'winphone6':
            case 'winphone7':
            case 'winphone7.5':
            case 'winphone7.10':
            case 'winphone8':
            case 'winphone8.1':
            case 'winphone10':
            case 'windows phone':
            case 'windows phone 7':
                return 'windows phone';
                break;
            case 'winmobile':
                return 'windows mobile os';
                break;
            case 'win32':
            case 'win16':
            case 'windows server':
                return 'windows';
                break;
            case 'rim os':
            case 'blackberry os':
                return 'rim os';
                break;
            case 'rim tablet os':
                return 'rim tablet os';
                break;
            case 'mac':
            case 'macosx':
            case 'os x':
            case 'mac osx':
                return 'mac os x';
                break;
            case 'macppc':
            case 'mac68k':
                return 'macintosh';
                break;
            case 'ios':
                return 'ios';
                break;
            case 'centos':
                return 'cent os linux';
                break;
            case 'jvm':
            case 'java':
                return 'java';
                break;
            case 'bada':
            case 'bada os':
                return 'bada';
                break;
            case 'brew':
                return 'brew';
                break;
            case 'webos':
                return 'webos';
                break;
            case 'symbianos':
                return 'symbian';
                break;
            case 'darwin':
                return 'darwin';
                break;
            case 'aix':
                return 'aix';
                break;
            case 'beos':
                return 'beos';
                break;
            case 'cygwin':
                return 'cygwin';
                break;
            case 'risc os':
                return 'risc os';
                break;
            case 'tru64 unix':
                return 'tru64 unix';
                break;
            case 'nokia series 40':
            case 'symbian os series 40':
                return 'nokia os';
                break;
            case 'gnu/linux':
            case 'linux':
                return 'linux';
                break;
            case 'unix':
                return 'unix';
                break;
            case 'debian':
                return 'debian';
                break;
            case 'ubuntu':
                return 'ubuntu';
                break;
            case 'chrome os':
            case 'chromeos':
                return 'chromeos';
                break;
            case 'mint':
                return 'linux mint';
                break;
            case 'android':
                return 'android';
                break;
            case 'hp-ux':
                return 'hp-ux';
                break;
            case 'bsd':
                return 'bsd';
                break;
            case 'freebsd':
                return 'freebsd';
                break;
            case 'openbsd':
                return 'openbsd';
                break;
            case 'netbsd':
                return 'netbsd';
                break;
            case 'dragonfly bsd':
                return 'dragonfly bsd';
                break;
            case 'sunos':
                return 'sunos';
                break;
            case 'solaris':
                return 'solaris';
                break;
            case 'irix64':
                return 'irix';
                break;
            case 'os/2':
                return 'os/2';
                break;
            case 'meego':
                return 'meego';
                break;
            case 'maemo':
                return 'linux smartphone os (maemo)';
                break;
            case 'tizen':
                return 'tizen';
                break;
            case 'openvms':
                return 'openvms';
                break;
            case 'firefoxos':
            case 'firefox os':
                return 'firefoxos';
                break;
            case 'palmos':
                return 'palmos';
                break;
            case 'amiga os':
                return 'amiga os';
                break;
            case 'cellos':
                return 'cellos';
                break;
            case 'wyderos':
                return 'wyderos';
                break;
            case 'liberate':
                return 'liberate';
                break;
            case 'sailfishos':
                return 'sailfishos';
                break;
            case 'syllable':
                return 'syllable';
                break;
            case 'inferno os':
                return 'inferno os';
                break;
            case 'miui os':
                return 'miui os';
                break;
            default:
                // nothing to do here
                break;
        }

        return 'unknown';
    }
204085
public static function check_ie_version($version = null) {
        // Internet Explorer.
        $properties = self::check_ie_properties();
        if (!is_array($properties)) {
            return false;
        }
        // In case of IE we have to deal with BC of the version parameter.
        if (is_null($version)) {
            $version = 5.5; // Anything older is not considered a browser at all!
        }
        // IE uses simple versions, let's cast it to float to simplify the logic here.
        $version = round($version, 1);
        return ($properties['version'] >= $version);
    }
556622
public function version($versionId, $reset = false)
    {
        $versions = $this->versions($reset);
        if (empty($versions[$versionId])) {
            return null;
        }

        return $versions[$versionId];
    }
293275
public function getVersion($versionNumber): Version
    {
        $versionNumber = $versionNumber instanceof VersionNumber
            ? $versionNumber
            : VersionNumber::fromValue($versionNumber);

        foreach ($this->listVersions() as $version) {
            if ($version->versionNumber()->equalsTo($versionNumber)) {
                return $version;
            }
        }

        throw VersionNotFound::withVersionNumber($versionNumber);
    }
227157
public function detectVersion(string $useragent): VersionInterface
    {
        $doMatch = preg_match('/\((?:build )?(\d+[A-Z]\d+(?:[a-z])?)\)/i', $useragent, $matches);

        if ($doMatch) {
            $buildVersion = OSXbuild::getVersion($matches[1]);

            if (false !== $buildVersion) {
                return (new VersionFactory())->set($buildVersion);
            }
        }

        $doMatch = preg_match('/coremedia v\d+\.\d+\.\d+\.(\d+[A-Z]\d+(?:[a-z])?)/i', $useragent, $matches);

        if ($doMatch) {
            $buildVersion = OSXbuild::getVersion($matches[1]);

            if (false !== $buildVersion) {
                return (new VersionFactory())->set($buildVersion);
            }
        }

        if (false !== mb_stripos($useragent, 'darwin')) {
            $searches = [
                '/darwin\/18\.2/i' => '10.14.2',
                '/darwin\/18\.1/i' => '10.14.1',
                '/darwin\/18/i' => '10.14.0',
                '/darwin\/17\.6/i' => '10.13.6',
                '/darwin\/17\.5/i' => '10.13.5',
                '/darwin\/17\.4/i' => '10.13.4',
                '/darwin\/17\.3/i' => '10.13.3',
                '/darwin\/17\.2/i' => '10.13.2',
                '/darwin\/17\.1/i' => '10.13.1',
                '/darwin\/17/i' => '10.13.0',
                '/darwin\/16\.6/i' => '10.12.6',
                '/darwin\/16\.5/i' => '10.12.5',
                '/darwin\/16\.4/i' => '10.12.4',
                '/darwin\/16\.3/i' => '10.12.3',
                '/darwin\/16\.2/i' => '10.12.2',
                '/darwin\/16\.1/i' => '10.12.1',
                '/darwin\/16/i' => '10.12.0',
                '/darwin\/15\.6/i' => '10.11.6',
                '/darwin\/15\.5/i' => '10.11.5',
                '/darwin\/15\.4/i' => '10.11.4',
                '/darwin\/15\.3/i' => '10.11.3',
                '/darwin\/15\.2/i' => '10.11.2',
                '/darwin\/15\.1/i' => '10.11.1',
                '/darwin\/15/i' => '10.11.0',
                '/darwin\/14\.5/i' => '10.10.5',
                '/darwin\/14\.4/i' => '10.10.4',
                '/darwin\/14\.3/i' => '10.10.3',
                '/darwin\/14\.2/i' => '10.10.2',
                '/darwin\/14\.1/i' => '10.10.1',
                '/darwin\/14/i' => '10.10.0',
                '/darwin\/13\.5/i' => '10.9.5',
                '/darwin\/13\.4/i' => '10.9.4',
                '/darwin\/13\.3/i' => '10.9.3',
                '/darwin\/13\.2/i' => '10.9.2',
                '/darwin\/13\.1/i' => '10.9.1',
                '/darwin\/13/i' => '10.9.0',
                '/darwin\/12\.5/i' => '10.8.5',
                '/darwin\/12\.4/i' => '10.8.4',
                '/darwin\/12\.3/i' => '10.8.3',
                '/darwin\/12\.2/i' => '10.8.2',
                '/darwin\/12\.1/i' => '10.8.1',
                '/darwin\/12/i' => '10.8.0',
                '/darwin\/11\.4\.2/i' => '10.7.5',
                '/darwin\/11\.4/i' => '10.7.4',
                '/darwin\/11\.3/i' => '10.7.3',
                '/darwin\/11\.2/i' => '10.7.2',
                '/darwin\/11\.1/i' => '10.7.1',
                '/darwin\/11/i' => '10.7.0',
                '/darwin\/10\.8/i' => '10.6.8',
                '/darwin\/10\.7/i' => '10.6.7',
                '/darwin\/10\.6/i' => '10.6.6',
                '/darwin\/10\.5/i' => '10.6.5',
                '/darwin\/10\.4/i' => '10.6.4',
                '/darwin\/10\.3/i' => '10.6.3',
                '/darwin\/10\.2/i' => '10.6.2',
                '/darwin\/10\.1/i' => '10.6.1',
                '/darwin\/10/i' => '10.6.0',
                '/darwin\/9\.8/i' => '10.5.8',
                '/darwin\/9\.7/i' => '10.5.7',
                '/darwin\/9\.6/i' => '10.5.6',
                '/darwin\/9\.5/i' => '10.5.5',
                '/darwin\/9\.4/i' => '10.5.4',
                '/darwin\/9\.3/i' => '10.5.3',
                '/darwin\/9\.2/i' => '10.5.2',
                '/darwin\/9\.1/i' => '10.5.1',
                '/darwin\/9/i' => '10.5.0',
                '/darwin\/8\.11/i' => '10.4.11',
                '/darwin\/8\.10/i' => '10.4.10',
                '/darwin\/8\.9/i' => '10.4.9',
                '/darwin\/8\.8/i' => '10.4.8',
                '/darwin\/8\.7/i' => '10.4.7',
                '/darwin\/8\.6/i' => '10.4.6',
                '/darwin\/8\.5/i' => '10.4.5',
                '/darwin\/8\.4/i' => '10.4.4',
                '/darwin\/8\.3/i' => '10.4.3',
                '/darwin\/8\.2/i' => '10.4.2',
                '/darwin\/8\.1/i' => '10.4.1',
                '/darwin\/8/i' => '10.4.0',
                '/darwin\/7\.9/i' => '10.3.9',
                '/darwin\/7\.8/i' => '10.3.8',
                '/darwin\/7\.7/i' => '10.3.7',
                '/darwin\/7\.6/i' => '10.3.6',
                '/darwin\/7\.5/i' => '10.3.5',
                '/darwin\/7\.4/i' => '10.3.4',
                '/darwin\/7\.3/i' => '10.3.3',
                '/darwin\/7\.2/i' => '10.3.2',
                '/darwin\/7\.1/i' => '10.3.1',
                '/darwin\/7/i' => '10.3.0',
                '/darwin\/6\.8/i' => '10.2.8',
                '/darwin\/6\.7/i' => '10.2.7',
                '/darwin\/6\.6/i' => '10.2.6',
                '/darwin\/6\.5/i' => '10.2.5',
                '/darwin\/6\.4/i' => '10.2.4',
                '/darwin\/6\.3/i' => '10.2.3',
                '/darwin\/6\.2/i' => '10.2.2',
                '/darwin\/6\.1/i' => '10.2.1',
                '/darwin\/6/i' => '10.2.0',
                '/darwin\/5\.5/i' => '10.1.5',
                '/darwin\/5\.4/i' => '10.1.4',
                '/darwin\/5\.3/i' => '10.1.3',
                '/darwin\/5\.2/i' => '10.1.2',
                '/darwin\/5\.1/i' => '10.1.1',
                '/darwin\/1\.4\.1/i' => '10.1.0',
                '/darwin\/1\.3\.1/i' => '10.0.0',
            ];

            foreach ($searches as $rule => $version) {
                if (preg_match($rule, $useragent)) {
                    return (new VersionFactory())->set($version);
                }
            }
        }

        $searches = ['Mac OS X Version', 'Mac OS X v', 'Mac OS X', 'OS X', 'os=mac '];

        $detectedVersion = (new VersionFactory())->detectVersion($useragent, $searches);

        if (preg_match('/(\d{2})(\d)(\d)?/', $detectedVersion->getVersion(VersionInterface::IGNORE_MINOR), $versions)) {
            $version = $versions[1] . '.' . $versions[2];

            if (isset($versions[3])) {
                $version .= '.' . $versions[3];
            }

            return (new VersionFactory())->set($version);
        }

        return $detectedVersion;
    }
909532
public function version(string $value = null)
    {
        if (null === $value) {
            return $this->version;
        }
        $this->version = $value;
        return $this;
    }
1130783
public function setVersion($version)
    {
        if (!in_array($version, $this->supportedVersions)) {
            $this->throwError('The version ' . $version . ' is not supported by this library');
        }

        $this->version = $version;

        return $this;
    }
57710
public function set(string $version): VersionInterface
    {
        $matches = [];
        $numbers = [];

        if (preg_match($this->regex, $version, $matches)) {
            $numbers = $this->mapMatches($matches);
        }

        if (empty($numbers)) {
            return new Version('0');
        }

        $major = (array_key_exists('major', $numbers) ? $numbers['major'] : '0');
        $minor = (array_key_exists('minor', $numbers) ? $numbers['minor'] : '0');

        if (array_key_exists('micro', $numbers)) {
            $micro      = $numbers['micro'];
            $patch      = (array_key_exists('patch', $numbers) ? $numbers['patch'] : null);
            $micropatch = (array_key_exists('micropatch', $numbers) ? $numbers['micropatch'] : null);
        } else {
            $micro      = '0';
            $patch      = null;
            $micropatch = null;
        }

        $stability = (array_key_exists('stability', $numbers)) ? $numbers['stability'] : null;

        if (null === $stability || 0 === mb_strlen($stability)) {
            $stability = 'stable';
        }

        $stability = mb_strtolower($stability);
        switch ($stability) {
            case 'rc':
                $stability = 'RC';

                break;
            case 'patch':
            case 'pl':
            case 'p':
                $stability = 'patch';

                break;
            case 'beta':
            case 'b':
                $stability = 'beta';

                break;
            case 'alpha':
            case 'a':
                $stability = 'alpha';

                break;
            case 'dev':
            case 'd':
                $stability = 'dev';

                break;
        }

        $build = (array_key_exists('build', $numbers)) ? $numbers['build'] : null;

        return new Version($major, $minor, $micro, $patch, $micropatch, $stability, $build);
    }
960870
public function mapBrowserVersion(?string $browserVersion, ?string $browserName = null): VersionInterface
    {
        return (new BrowserVersionMapper())->mapBrowserVersion($browserVersion, $browserName);
    }
656917
protected function setVersion($version)
    {
        $cleanVer = $this->cleanVersion($version);

        if ($cleanVer == '') {
            $this->_version = self::VERSION_UNKNOWN;
        } else {
            $this->_version = $cleanVer;
        }
    }
376688
public static function parseVersion($version)
    {
        if (preg_match('#^(\d+)\.(\d+)\.(\d+)(\-([\w.\-]+)|)$#', $version, $match)) {
            return (object) array(
                'major' => $match[1],
                'minor' => $match[2],
                'patch' => $match[3],
                'extra' => empty($match[5]) ? null : $match[5]
            );
        }

        return false;
    }
674527
public function versions($reset = false)
    {
        if ($reset === false && $this->has('_versions')) {
            return $this->get('_versions');
        }

        /*
         * @var \Josegonzalez\Version\Model\Behavior\VersionBehavior $table
         * @var \Cake\Datasource\EntityInterface $this
         */
        $table = TableRegistry::get($this->getSource());
        $versions = $table->getVersions($this);
        $this->set('_versions', $versions);

        return $this->get('_versions');
    }
1207089
public function getOneVersion($versionNumber, $con = null)
    {
        return ChildDealerContentVersionQuery::create()
            ->filterByDealerContent($this)
            ->filterByVersion($versionNumber)
            ->findOne($con);
    }
1054141
public function getOneVersion($versionNumber, $con = null)
    {
        return ChildIndexEngineIndexVersionQuery::create()
            ->filterByIndexEngineIndex($this)
            ->filterByVersion($versionNumber)
            ->findOne($con);
    }