This method checks for a certain property in the
userAgent.
@todo: The httpHeaders part is not yet used.

@param  string        $key
@param  string        $userAgent   deprecated
@param  string        $httpHeaders deprecated
@return bool|int|null
431716
public function is($key, $userAgent = null, $httpHeaders = null)
	{
		// Set the UA and HTTP headers only if needed (eg. batch mode).
		if ($httpHeaders) {
			$this->setHttpHeaders($httpHeaders);
		}

		if ($userAgent) {
			$this->setUserAgent($userAgent);
		}

		$this->setDetectionType(self::DETECTION_TYPE_EXTENDED);

		return $this->matchUAAgainstKey($key);
	}
129172
public function canHandle($userAgent)
    {
        if (Utils::isMobileBrowser($userAgent)) {
            return false;
        }

        return Utils::checkIfContains($userAgent, 'Safari')
            && Utils::checkIfStartsWithAnyOf($userAgent, array('Mozilla/5.0 (Macintosh', 'Mozilla/5.0 (Windows'));
    }
875652
public function load(string $key, string $useragent = ''): array
    {
        if (!$this->initData->hasItem($key)) {
            throw new NotFoundException('the device with key "' . $key . '" was not found');
        }

        $deviceData = $this->initData->getItem($key);

        if (null === $deviceData) {
            throw new NotFoundException('the device with key "' . $key . '" was not found');
        }

        $platformKey = $deviceData->platform;
        $platform    = null;

        if (null !== $platformKey) {
            try {
                $platform = $this->platformParser->load($platformKey, $useragent);
            } catch (NotFoundException $e) {
                $this->logger->warning($e);
            }
        }

        $deviceFactory = new DeviceFactory(
            $this->companyLoader,
            new \UaDeviceType\TypeLoader(),
            new DisplayFactory(new \UaDisplaySize\TypeLoader())
        );
        $device = $deviceFactory->fromArray($this->logger, (array) $deviceData, $useragent);

        return [$device, $platform];
    }
338412
private static boolean isApplicationHeader(String key) {
    // Don't allow reserved non HTTP/2 pseudo headers to be added
    // HTTP/2 headers can not be created as keys because Header.Key disallows the ':' character.
    return !CONTENT_TYPE_KEY.name().equalsIgnoreCase(key)
        && !USER_AGENT_KEY.name().equalsIgnoreCase(key)
        && !TE_HEADER.name().equalsIgnoreCase(key);
  }
1267120
public function setDefaults($userAgent = null)
    {
        $this->setDefaultHeaders();
        $this->setDefaultOptions();

        if (!empty($userAgent)) {
            $this->setUserAgent($userAgent);
        } else {
            $this->setUserAgent('chrome');
        }
    }
629866
public static function isSmartTV($userAgent)
    {
        if (self::$isSmartTv !== null) {
            return self::$isSmartTv;
        }
        self::$isSmartTv = false;
        $userAgent       = strtolower($userAgent);
        foreach (self::$smartTVBrowsers as $key) {
            if (strpos($userAgent, $key) !== false) {
                self::$isSmartTv = true;
                break;
            }
        }

        return self::$isSmartTv;
    }
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;
    }
375931
public function match($userAgentString)
    {
        foreach ($this->getValues() as $userAgentIdentifier) {
            if ($userAgentIdentifier === UserAgentDirective::DEFAULT_USER_AGENT) {
                continue;
            }

            if (substr_count($userAgentString, $userAgentIdentifier)) {
                return $userAgentIdentifier;
            }
        }

        return null;
    }
528926
public function setUserAgent($userAgent) {
		$this->userAgent = $userAgent;
		$this->removeHeader(self::HEADER_KEY_USER_AGENT);
		$this->addHeader(self::HEADER_KEY_USER_AGENT, $userAgent);
		return $this;
	}
923030
protected Object checkUserAgent(ServerUserHandlerClass handler, ApiUser userAgent) {
        if(handler.getUserClass().isAssignableFrom(userAgent.getClass()))
            return userAgent;
        return UserAgentUtil.getGameUser(userAgent, handler.getUserClass());
    }
1344248
public function setUserAgent($userAgent)
    {
        if (is_object($userAgent)) {
            $this->userAgent = $userAgent;
        } elseif (is_array($userAgent)) {
            $this->userAgent = new UserAgent($userAgent);
        }
    }
294097
public function httpGet($url, $userAgent = null)
    {
        $ch = $this->commonCurlParams($url,$userAgent);

        // Setting the HTTP header with the Access Token only for Getting user info
        if ($this->header) {
            $this->headerArray[] = 'Authorization: bearer ' . $this->accessToken;
        }

        $response = $this->execute($ch);
        return $response;
    }
458137
public function load(string $key, string $useragent = ''): array
    {
        if (!$this->initData->hasItem($key)) {
            throw new NotFoundException('the browser with key "' . $key . '" was not found');
        }

        $browserData = $this->initData->getItem($key);

        if (null === $browserData) {
            throw new NotFoundException('the browser with key "' . $key . '" was not found');
        }

        $engineKey = $browserData->engine;
        $engine    = null;

        if (null !== $engineKey) {
            try {
                $engine = $this->engineParser->load($engineKey, $useragent);
            } catch (NotFoundException $e) {
                $this->logger->warning($e);
            }
        }

        $browser = (new BrowserFactory($this->companyLoader, new VersionFactory(), new TypeLoader()))->fromArray($this->logger, (array) $browserData, $useragent);

        return [$browser, $engine];
    }
1326062
private static HeaderProvider buildHeaderProvider(String userAgent){
    return FixedHeaderProvider.create(USER_AGENT_KEY.name(), VENEER_ADAPTER + userAgent);
  }
1139952
public function lookForMatchingUserAgent($userAgent)
    {
        $tolerance = Utils::firstSlash($userAgent);

        return Utils::risMatch($this->userAgents, $userAgent, $tolerance);
    }
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;
    }
1025646
public static function checkAgent($UserAgent=false, $ouputBotName = 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.
        }
    
        //Search in browsecap
        $objBrowscap = static::getBrowscapInfo($UserAgent);
        // DEBUG fwrite(STDOUT, 'BrowscapInfo: '.print_r($objBrowscap,true) . "\n");
        if ($objBrowscap->crawler == 'true') 
        {
            if (false === $ouputBotName) 
            {
            	return true;
            }
            else 
            {
                // DEBUG fwrite(STDOUT, "\n" . 'Agent: '.print_r($UserAgent,true) . "\n");
                // DEBUG fwrite(STDOUT, 'Bot: '.print_r($objBrowscap->browser_type,true) . "\n");
                return $objBrowscap->browser;
            }
            
        }
        
        // Search in bot-agent-list
        if (file_exists(__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'config/bot-agent-list.php'))
        {
            include(__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'config/bot-agent-list.php');
        }
        else
        {
            return false;	// no definition, no search
        }
        // search for user bot filter definitions in localconfig.php
        if ( isset($GLOBALS['BOTDETECTION']['BOT_AGENT']) )
        {
            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
                // Debug fwrite(STDOUT, 'Bot: '.print_r($botagents[$arrBots[$c]],true) . "\n");
                if (false === $ouputBotName)
                {
                    return true;
                }
                else 
                {
                    return $botagents[$arrBots[$c]];
                }
            }
        }
        return false;
    }