@param string $userAgent
@param bool   $useDefault

@return float|null
488971
public static function getUcAndroidVersion($userAgent, $useDefault = true)
    {
        if (preg_match('/; Adr (\d+\.\d+)\.?/', $userAgent, $matches)) {
            $u2k_an_version = $matches[1];

            if (in_array($u2k_an_version, AndroidHandler::$validAndroidVersions)) {
                return $u2k_an_version;
            }
        }

        return $useDefault ? AndroidHandler::ANDROID_DEFAULT_VERSION : null;
    }
544364
public static function isDesktopBrowser($userAgent)
    {
        if (self::$isDesktopBrowser !== null) {
            return self::$isDesktopBrowser;
        }

        self::$isDesktopBrowser = false;
        $userAgent              = strtolower($userAgent);

        foreach (self::$desktopBrowsers as $key) {
            if (strpos($userAgent, $key) !== false) {
                self::$isDesktopBrowser = true;
                break;
            }
        }

        return self::$isDesktopBrowser;
    }
1001914
public String getUserAgent(FacesContext facesContext)
    {
        if (userAgent == null)
        {
            synchronized (this)
            {
                if (userAgent == null)
                {
                    Map<String, String[]> requestHeaders =
                            facesContext.getExternalContext().getRequestHeaderValuesMap();

                    if (requestHeaders != null &&
                            requestHeaders.containsKey("User-Agent"))
                    {
                        String[] userAgents = requestHeaders.get("User-Agent");
                        userAgent = userAgents.length > 0 ? userAgents[0] : null;
                    }
                }
            }
        }

        return userAgent;
    }
994137
public function filter($userAgent, $deviceID)
    {
        WURFL_Handlers_Utils::reset();
        $generic_normalizer = WURFL_UserAgentHandlerChainFactory::createGenericNormalizers();
        $userAgent = $generic_normalizer->normalize($userAgent);
        $this->_userAgentHandlers[0]->filter($userAgent, $deviceID);
    }
409232
public function applyConclusiveMatch($userAgent)
    {
        $tolerance = Utils::firstSpace($userAgent);

        return $this->getDeviceIDFromRIS($userAgent, $tolerance);
    }
451217
public static function detect(Browser $browser, UserAgent $userAgent = null)
    {
        self::$browser = $browser;
        if (is_null($userAgent)) {
            $userAgent = self::$browser->getUserAgent();
        }
        self::$userAgentString = $userAgent->getUserAgentString();

        self::$browser->setName(Browser::UNKNOWN);
        self::$browser->setVersion(Browser::VERSION_UNKNOWN);

        self::checkChromeFrame();
        self::checkFacebookWebView();

        foreach (self::$browsersList as $browserName) {
            $funcName = self::FUNC_PREFIX . $browserName;

            if (self::$funcName()) {
                return true;
            }
        }

        return false;
    }
182648
public function robot($userAgent = null)
    {
        if ($this->getCrawlerDetect()->isCrawler($userAgent ?: $this->userAgent)) {
            return ucfirst($this->getCrawlerDetect()->getMatches());
        }

        return false;
    }
913627
public static function getMobileCatchAllId($userAgent) {
		foreach (self::$mobileCatchAllIds as $key => $deviceId) {
			if (strpos($userAgent, $key) !== false) {
				return $deviceId;
			}
		}
		return WURFL_Constants::NO_MATCH;
	}
438692
public function filter($userAgent, $deviceID)
    {
        Utils::reset();

        $genericNormalizer = UserAgentHandlerChainFactory::createGenericNormalizers();
        $userAgent         = $genericNormalizer->normalize($userAgent);

        $handlers = $this->getHandlers();

        foreach ($handlers as $handler) {
            /** @var $handler \Wurfl\Handlers\AbstractHandler */
            $handler->setLogger($this->logger);

            if ($handler->filter($userAgent, $deviceID)) {
                break;
            }
        }
    }
1267120
public function setDefaults($userAgent = null)
    {
        $this->setDefaultHeaders();
        $this->setDefaultOptions();

        if (!empty($userAgent)) {
            $this->setUserAgent($userAgent);
        } else {
            $this->setUserAgent('chrome');
        }
    }
1328688
public static function isMobileBrowser($userAgent)
    {
        $userAgent_lower = strtolower($userAgent);
        if (self::$isMobileBrowser === null) {
            if (self::isDesktopBrowser($userAgent)) {
                self::$isMobileBrowser = false;
            } elseif (self::checkIfContainsAnyOf($userAgent_lower, self::$mobileBrowsers)) {
                self::$isMobileBrowser = true;
            } elseif (self::regexContains($userAgent, '/[^\d]\d{3}x\d{3}/')) {
                self::$isMobileBrowser = true;
            } else {
                self::$isMobileBrowser = false;
            }
        }

        return self::$isMobileBrowser;
    }
1148478
public static function checkAgent($UserAgent=false)
    {
        // Check if user agent present
   	    if ($UserAgent === false) 
   	    {
            return false; // No user agent, no search.
   	    }
   	    
   	    $UserAgent = trim( $UserAgent );
        if (false === (bool) $UserAgent) 
        { 
           return false; // No user agent, no search.
        }
        
        
        // Rough search
        $CheckUserAgent = str_ireplace(static::$_BotsRough, '#', $UserAgent);
        if ($UserAgent != $CheckUserAgent)
        { 
            // found
            return true;
        }
        
        // Fine search
        $CheckUserAgent = str_ireplace(static::$_BotsFine, '#', $UserAgent);
        if ($UserAgent != $CheckUserAgent)
        { 
            // found
            return true;
        }
        
        // Feature #76, search for user bot filter definitions in localconfig.php
        if ( isset($GLOBALS['BOTDETECTION']['BOT_AGENT']) )
        {
            $botagents = array();
            foreach ($GLOBALS['BOTDETECTION']['BOT_AGENT'] as $search)
            {
                $botagents[$search[0]] = $search[1];
            }
            $num = count($botagents);
            $arrBots = array_keys($botagents);
            for ($c=0; $c < $num; $c++)
            {
                $CheckUserAgent = str_ireplace($arrBots[$c], '#', $UserAgent);
                if ($UserAgent != $CheckUserAgent)
                {   
                    // found
                    return true;
                }
            }
        }
        return false;
    }
639867
public function applyConclusiveMatch($userAgent)
    {
        if (Utils::checkIfContains($userAgent, 'GoogleImageProxy')) {
            return 'google_image_proxy';
        }

        if (Utils::checkIfStartsWith($userAgent, 'Mozilla')) {
            $tolerance = Utils::firstCloseParen($userAgent);
        } else {
            $tolerance = Utils::firstSlash($userAgent);
        }

        return $this->getDeviceIDFromRIS($userAgent, $tolerance);
    }
743110
public function applyConclusiveMatch($userAgent)
    {
        $delimiterIndex = strpos($userAgent, WurflConstants::RIS_DELIMITER);

        if ($delimiterIndex !== false) {
            $tolerance = $delimiterIndex + strlen(WurflConstants::RIS_DELIMITER);

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

        return WurflConstants::NO_MATCH;
    }
117499
public function robot($userAgent = null)
    {
        return $this->isRobot($userAgent)
            ? ucfirst($this->getCrawlerDetector()->getMatches())
            : false;
    }
1189022
public function getDeviceForUserAgent($userAgent)
    {
        if (!isset($userAgent)) {
            $userAgent = '';
        }
        
        $request = $this->_requestFactory->createRequestForUserAgent($userAgent);
        return $this->getDeviceForRequest($request);
    }
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';
    }