src/Version/AndroidOs.php
/**
     * returns the version of the operating system/platform
     *
     * @throws UnexpectedValueException
     */
returns the version of the operating system/platform
@throws UnexpectedValueException
returns the version of the operating system / platform @throws UnexpectedValueException
public function detectVersion(string $useragent): VersionInterface
    {
        if (false !== mb_stripos($useragent, 'android 2.1-update1')) {
            try {
                return $this->versionFactory->set('2.1.1');
            } catch (NotNumericException $e) {
                $this->logger->info($e);
                return new NullVersion();
            }
        }
        if (false !== mb_stripos($useragent, 'android m;')) {
            try {
                return $this->versionFactory->set('6.0');
            } catch (NotNumericException $e) {
                $this->logger->info($e);
                return new NullVersion();
            }
        }
        if (preg_match('/Android \(\d+\/(?P<version>\d+[\d\.]+)/', $useragent, $matches)) {
            try {
                return $this->versionFactory->set($matches['version']);
            } catch (NotNumericException $e) {
                $this->logger->info($e);
                return new NullVersion();
            }
        }
        try {
            $detectedVersion = $this->versionFactory->detectVersion($useragent, self::SEARCHES);
        } catch (NotNumericException $e) {
            $this->logger->info($e);
            return new NullVersion();
        }
        if (null !== $detectedVersion->getVersion()) {
            return $detectedVersion;
        }
        if (preg_match('/Linux; (?P<version>\d+[\d\.]+)/', $useragent, $matches)) {
            try {
                return $this->versionFactory->set($matches['version']);
            } catch (NotNumericException $e) {
                $this->logger->info($e);
            }
            return new NullVersion();
        }
        if (false !== mb_stripos($useragent, 'gingerbread')) {
            try {
                return $this->versionFactory->set('2.3.0');
            } catch (NotNumericException $e) {
                $this->logger->info($e);
            }
            return new NullVersion();
        }
        if (false !== mb_stripos($useragent, 'android eclair')) {
            try {
                return $this->versionFactory->set('2.1.0');
            } catch (NotNumericException $e) {
                $this->logger->info($e);
            }
        }
        return new NullVersion();
    }
public function detectVersion ( string $ useragent ) : VersionInterface { if ( false !== mb_stripos ( $ useragent , 'android 2.1-update1' ) ) { try { return $ this -> versionFactory -> set ( '2.1.1' ) ; } catch ( NotNumericException $ e ) { $ this -> logger -> info ( $ e ) ; return new NullVersion ( ) ; } } if ( false !== mb_stripos ( $ useragent , 'android m;' ) ) { try { return $ this -> versionFactory -> set ( '6.0' ) ; } catch ( NotNumericException $ e ) { $ this -> logger -> info ( $ e ) ; return new NullVersion ( ) ; } } if ( preg_match ( '/Android \(\d+\/(?P<version>\d+[\d\.]+)/' , $ useragent , $ matches ) ) { try { return $ this -> versionFactory -> set ( $ matches [ 'version' ] ) ; } catch ( NotNumericException $ e ) { $ this -> logger -> info ( $ e ) ; return new NullVersion ( ) ; } } try { $ detectedVersion = $ this -> versionFactory -> detectVersion ( $ useragent , self :: SEARCHES ) ; } catch ( NotNumericException $ e ) { $ this -> logger -> info ( $ e ) ; return new NullVersion ( ) ; } if ( null !== $ detectedVersion -> getVersion ( ) ) { return $ detectedVersion ; } if ( preg_match ( '/Linux; (?P<version>\d+[\d\.]+)/' , $ useragent , $ matches ) ) { try { return $ this -> versionFactory -> set ( $ matches [ 'version' ] ) ; } catch ( NotNumericException $ e ) { $ this -> logger -> info ( $ e ) ; } return new NullVersion ( ) ; } if ( false !== mb_stripos ( $ useragent , 'gingerbread' ) ) { try { return $ this -> versionFactory -> set ( '2.3.0' ) ; } catch ( NotNumericException $ e ) { $ this -> logger -> info ( $ e ) ; } return new NullVersion ( ) ; } if ( false !== mb_stripos ( $ useragent , 'android eclair' ) ) { try { return $ this -> versionFactory -> set ( '2.1.0' ) ; } catch ( NotNumericException $ e ) { $ this -> logger -> info ( $ e ) ; } } return new NullVersion ( ) ; }
returns the version of the operating system/platform
 @throws UnexpectedValueException
returns the version of the operating system / platform @throws UnexpectedValueException