Adds the pair $userAgent, $deviceID to the clusters they belong to.

@param string $userAgent
@param string $deviceID

@see \Wurfl\Handlers\AbstractHandler::filter()
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;
            }
        }
    }
838287
public function createRequestFromString(string $userAgent): GenericRequest
    {
        if (!HeaderSecurity::isValid($userAgent)) {
            $userAgent = $this->filterHeader($userAgent);
        }

        $message = ServerRequestFactory::fromGlobals([Constants::HEADER_HTTP_USERAGENT => $userAgent]);

        return $this->createRequestFromPsr7Message($message);
    }
686745
public void setUserAgent(String userAgent) {
        this.userAgent = userAgent.toLowerCase();

        // Re-order the set
        Set<UserAgentDirectives> replace = new TreeSet<UserAgentDirectives>(
            new UserAgentDirectives.UserAgentComparator(this.userAgent));
        replace.addAll(rules);
        rules = replace;
    }
54743
private static function checkIpad(Device $device, UserAgent $userAgent)
    {
        if (stripos($userAgent->getUserAgentString(), 'ipad') !== false) {
            $device->setName(Device::IPAD);
            return true;
        }

        return false;
    }
1167292
private static function checkIphone(Device $device, UserAgent $userAgent)
    {
        if (stripos($userAgent->getUserAgentString(), 'iphone;') !== false) {
            $device->setName(Device::IPHONE);
            return true;
        }

        return false;
    }
250216
public function getDevice($userAgent)
    {
        $success = null;
        $data    = $this->getAdapter()->getItem($userAgent, $success);

        if (!$success) {
            return;
        }

        return $data;
    }
488282
protected function filterBrowserNames(array $userAgent)
    {
        // IE11 hasn't 'MSIE' in its user agent string
        if (empty($userAgent['browser_name']) && $userAgent['browser_engine'] === 'trident' && strpos($userAgent['string'], 'rv:')) {
            $userAgent['browser_name'] = 'msie';
            $userAgent['browser_version'] = preg_replace('|.+rv:([0-9]+(?:\.[0-9]+)+).+|', '$1', $userAgent['string']);

            return $userAgent;
        }

        return $userAgent;
    }
1267120
public function setDefaults($userAgent = null)
    {
        $this->setDefaultHeaders();
        $this->setDefaultOptions();

        if (!empty($userAgent)) {
            $this->setUserAgent($userAgent);
        } else {
            $this->setUserAgent('chrome');
        }
    }
1021165
public function applyConclusiveMatch($userAgent)
    {
        //High accuracy mode
        $tolerance = Utils::firstCloseParen($userAgent);

        return $this->getDeviceIDFromRIS($userAgent, $tolerance);
    }
32180
public function canHandle($userAgent)
    {
        if (Utils::isDesktopBrowser($userAgent)) {
            return false;
        }

        return (Utils::checkIfStartsWith($userAgent, 'Mozilla') && Utils::checkIfContains($userAgent, 'UCBrowser'));
    }
599934
public function userIdToOpenid(string $userId, int $agentId = null)
    {
        $params = [
            'userid' => $userId,
            'agentid' => $agentId,
        ];

        return $this->httpPostJson('cgi-bin/user/convert_to_openid', $params);
    }
822937
public function load(string $company, string $key, string $useragent = ''): array
    {
        $loaderFactory = $this->loaderFactory;

        /** @var \BrowserDetector\Loader\DeviceLoader $loader */
        $loader = $loaderFactory($company);

        return $loader->load($key, $useragent);
    }
1245201
public static function detect(Device $device, UserAgent $userAgent)
    {
        $device->setName($device::UNKNOWN);

        return (
            self::checkIpad($device, $userAgent) ||
            self::checkIphone($device, $userAgent) ||
            self::checkWindowsPhone($device, $userAgent) ||
            self::checkSamsungPhone($device, $userAgent)
        );
    }
1123001
public function isMobile(string $useragent): bool
    {
        if (preg_match('/xbox|googletv|eeepc|smart-?tv|sonydtv|hbbtv|gxt_dongle_3188|apple tv|mxl661l32|nettv|crkey|lenovog780|windows iot|netcast|raspbian|bravia|tablet pc [12]\.|automobile|netgem|wordpress/i', $useragent)) {
            return false;
        }

        if (preg_match('/iphone.*windows nt.*micromessenger/i', $useragent)) {
            return true;
        }

        if (preg_match('/windows nt.*arm;/i', $useragent)) {
            return true;
        }

        // ignore mobile safari token if windows nt token is available
        if (preg_match('/windows nt.*(mobile safari|opera mobi|iphone)/i', $useragent)) {
            return false;
        }

        if (preg_match('/Puffin\/[\d\.]+WD/', $useragent)) {
            return false;
        }

        if (preg_match('/UCWEB|Puffin\/[\d\.]+[AIWM][TP]?|TBD\d{4}|TBD[BCG]\d{3,4}/', $useragent)) {
            return true;
        }

        if (preg_match('/fbid\/desktop/i', $useragent)) {
            return false;
        }

        if (preg_match('/mobile;|mobileok|-mobile|office mobile|tablet|(?<!a)phone|wireless|wpdesktop|zunewp7|xblwp7|(?<!ninesky-)android|adr |iphone|ip[ao]d|samsung(?!browser|-agent)|j2me|micromax|htc|karbonn|hisense|docomo|siemens(?! ?(a\/s|testmanager|lms|ag))|ktouch|portalmmm|rim tablet|jolla|iball|windows mobile|windows ce|symbos|symbian|remixos|webos|velocitymicro|samsung-(gt|sph)|lenovo|lumia|surftab|padfone|xda_diamond_2|transformer tf|touchpad|toshiba_ac_and_az|hpwos|silk|wap-browser|sailfish|crowsnest|folio_and_a|steelcore|m2 note|spice qt-75|spark284|lemon b556|terra_101|dino762|wetab|dataaccessd|lenovotablet|qtcarbrowser|onebrowser|stitcher|rss_?radio|antennapod|antenna\/|podcruncher|captivenetworksupport|(?<!c)ios;|audioboom.com\/boos|beyondpod|st80208|\[fban|wap2|up\.link|up\.browser|series ?[46]0|pocket ?pc|playstation|palm(?!a)|opera mobi|opera mini|openwave|obigo|nokia|nintendo|netfront|mqqbrowser|midp|meego|maemo|look-alike|linux armv|like mac os x|kindle|juc ?\(linux; ?u;|j2me|iuc\(u;ios|iris|hp-tablet|hd_mini_t|gingerbread|folio100|foma|firefox or ie|embider|danger hiptop|cldc|blazer|dalvik|bolt|blackberry|\b(bb10|bada|brew|mtk)\b|\btcl\b(?! http client)|aspen simulator|arm; touch|wap browser|kyy21|ebrd1101|ebrd1201|huawei-u8651|tizen/i', $useragent)) {
            return true;
        }

        return false;
    }
313882
public function userAgent($useragent) {

		if(false === is_string($useragent)) {
            return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($useragent)), E_USER_ERROR);
        }

		$this -> options[CURLOPT_USERAGENT] = $useragent;

		return $this;
	}
558494
public void addUserAgent(String userAgent) {
    if (userAgent.equals("*")) {
      anyAgent = true;
    } else {
      this.userAgents.add(userAgent);
    }
  }
690399
public function applyConclusiveMatch($userAgent)
    {
        $match = $this->lookForMatchingUserAgent($userAgent);

        if (!empty($match)) {
            return $this->userAgentsWithDeviceID[$match];
        }

        return WurflConstants::NO_MATCH;
    }