Determine if the device is Windows Phone.

@param Device $device
@param UserAgent $userAgent
@return bool
497154
private static function checkWindowsPhone(Device $device, UserAgent $userAgent)
    {
        if (stripos($userAgent->getUserAgentString(), 'Windows Phone') !== false) {
            if (preg_match('/Microsoft; (Lumia [^)]*)\)/', $userAgent->getUserAgentString(), $matches)) {
                $device->setName($matches[1]);
                return true;
            }

            $device->setName($device::WINDOWS_PHONE);
            return true;
        }
        return false;
    }
325560
public function applyConclusiveMatch($userAgent)
    {
        $idx       = strpos($userAgent, 'Nokia');
        $tolerance = Utils::indexOfAnyOrLength($userAgent, array('/', ' '), $idx);

        return $this->getDeviceIDFromRIS($userAgent, $tolerance);
    }
213945
private function validateDevice(ModelDeviceInterface $device)
    {
        // Must have a valid wurfl ID
        if (strlen($device->id) === 0) {
            return false;
        }

        // Must have a valid User Agent unless it's "generic"
        if (strlen($device->userAgent) === 0 && $device->id !== 'generic') {
            return false;
        }

        return true;
    }
298321
public function isDesktop($userAgent = null, $httpHeaders = null)
    {
        return !$this->isMobile($userAgent, $httpHeaders) && !$this->isTablet($userAgent, $httpHeaders) && !$this->isRobot($userAgent);
    }
647610
public function applyRecoveryMatch($userAgent)
    {
        $isOperaMobi   = Utils::checkIfContains($userAgent, 'Opera Mobi');
        $isOperaTablet = Utils::checkIfContains($userAgent, 'Opera Tablet');

        if ($isOperaMobi || $isOperaTablet) {
            $androidVersion       = AndroidHandler::getAndroidVersion($userAgent);
            $androidVersionString = str_replace('.', '_', $androidVersion);
            $type                 = $isOperaTablet ? 'tablet' : 'mobi';
            $deviceID             = 'generic_android_ver' . $androidVersionString . '_opera_' . $type;

            if (in_array($deviceID, self::$constantIDs)) {
                return $deviceID;
            } else {
                return $isOperaTablet ? 'generic_android_ver2_1_opera_tablet' : 'generic_android_ver2_0_opera_mobi';
            }
        }

        return WurflConstants::NO_MATCH;
    }
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;
    }
596229
function DetectWindowsPhone7()
   {
      if (stripos($this->useragent, $this->deviceWinPhone7) > -1)
         return $this->true; 
      else
         return $this->false; 
   }
777948
public boolean detectNintendo() {

        if ((userAgent.indexOf(deviceNintendo) != -1)
            || (userAgent.indexOf(deviceWii) != -1)
            || (userAgent.indexOf(deviceNintendoDs) != -1)) {
            return true;
        }
        return false;
    }
425583
private static function checkNokia(Os $os, UserAgent $userAgent)
    {
        if (stripos($userAgent->getUserAgentString(), 'Nokia') !== false) {
            $os->setVersion($os::VERSION_UNKNOWN);
            $os->setName($os::NOKIA);
            $os->setIsMobile(true);

            return true;
        }

        return false;
    }
1084232
public static function isRobot($userAgent) {
		if (self::$_is_robot !== null) return self::$_is_robot;
		self::$_is_robot = false;
		$userAgent = strtolower($userAgent);
		foreach (self::$robots as $key) {
			if (strpos($userAgent, $key) !== false) {
				self::$_is_robot = true;
				break;
			}
		}
		return self::$_is_robot;
	}
314273
protected function detectEngine($userAgent)
	{
		if (stripos($userAgent, 'MSIE') !== false || stripos($userAgent, 'Trident') !== false)
		{
			// Attempt to detect the client engine -- starting with the most popular ... for now.
			$this->engine = self::TRIDENT;
		}
		elseif (stripos($userAgent, 'Edge') !== false || stripos($userAgent, 'EdgeHTML') !== false)
		{
			$this->engine = self::EDGE;
		}
		elseif (stripos($userAgent, 'Edg') !== false)
		{
			$this->engine = self::BLINK;
		}
		elseif (stripos($userAgent, 'Chrome') !== false)
		{
			$result  = explode('/', stristr($userAgent, 'Chrome'));
			$version = explode(' ', $result[1]);

			if ($version[0] >= 28)
			{
				$this->engine = self::BLINK;
			}
			else
			{
				$this->engine = self::WEBKIT;
			}
		}
		elseif (stripos($userAgent, 'AppleWebKit') !== false || stripos($userAgent, 'blackberry') !== false)
		{
			if (stripos($userAgent, 'AppleWebKit') !== false)
			{
				$result  = explode('/', stristr($userAgent, 'AppleWebKit'));
				$version = explode(' ', $result[1]);

				if ($version[0] === 537.36)
				{
					// AppleWebKit/537.36 is Blink engine specific, exception is Blink emulated IEMobile, Trident or Edge
					$this->engine = self::BLINK;
				}
			}

			// Evidently blackberry uses WebKit and doesn't necessarily report it.  Bad RIM.
			$this->engine = self::WEBKIT;
		}
		elseif (stripos($userAgent, 'Gecko') !== false && stripos($userAgent, 'like Gecko') === false)
		{
			// We have to check for like Gecko because some other browsers spoof Gecko.
			$this->engine = self::GECKO;
		}
		elseif (stripos($userAgent, 'Opera') !== false || stripos($userAgent, 'Presto') !== false)
		{
			$version = false;

			if (preg_match('/Opera[\/| ]?([0-9.]+)/u', $userAgent, $match))
			{
				$version = \floatval($match[1]);
			}

			if (preg_match('/Version\/([0-9.]+)/u', $userAgent, $match))
			{
				if (\floatval($match[1]) >= 10)
				{
					$version = \floatval($match[1]);
				}
			}

			if ($version !== false && $version >= 15)
			{
				$this->engine = self::BLINK;
			}
			else
			{
				$this->engine = self::PRESTO;
			}
		}
		elseif (stripos($userAgent, 'KHTML') !== false)
		{
			// *sigh*
			$this->engine = self::KHTML;
		}
		elseif (stripos($userAgent, 'Amaya') !== false)
		{
			// Lesser known engine but it finishes off the major list from Wikipedia :-)
			$this->engine = self::AMAYA;
		}

		// Mark this detection routine as run.
		$this->detection['engine'] = true;
	}
427679
public function applyConclusiveMatch($userAgent)
    {
        $tolerance = Utils::toleranceToRisDelimeter($userAgent);
        if ($tolerance !== false) {
            return $this->getDeviceIDFromRIS($userAgent, $tolerance);
        }

        return WurflConstants::NO_MATCH;
    }
11939
public function filter($userAgent, $deviceID) {
		WURFL_Handlers_Utils::reset();
		$this->_userAgentHandlers[0]->filter($userAgent, $deviceID);
	}
1021165
public function applyConclusiveMatch($userAgent)
    {
        //High accuracy mode
        $tolerance = Utils::firstCloseParen($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;
    }
1111838
public function applyConclusiveMatch($userAgent) {
		$deviceId = WURFL_Constants::GENERIC;
		if (WURFL_Handlers_Utils::checkIfStartsWith($userAgent, 'Mozilla')) {
			$deviceId = $this->applyMozillaConclusiveMatch($userAgent);
		} else {
			$tolerance = WURFL_Handlers_Utils::firstSlash($userAgent);
			$deviceId = $this->getDeviceIDFromRIS($userAgent, $tolerance);
		}
		
		return $deviceId;
	}
837540
protected function detectDevice($userAgent)
    {
        // Attempt to detect the client platform.
        switch (true) {
            case stripos($userAgent, 'Windows') !== false:
                $this->device = self::DEVICE_WINDOWS;

                // Let's look at the specific mobile options in the Windows space.
                if (stripos($userAgent, 'Windows Phone') !== false) {
                    $this->mobile = true;
                    $this->device = self::DEVICE_WINDOWS_PHONE;
                } elseif (stripos($userAgent, 'Windows CE') !== false) {
                    $this->mobile = true;
                    $this->device = self::DEVICE_WINDOWS_CE;
                }

                break;

            case stripos($userAgent, 'iPhone') !== false:
                // Interestingly 'iPhone' is present in all iOS devices so far including iPad and iPods.
                $this->mobile = true;
                $this->device = self::DEVICE_IPHONE;

                // Let's look at the specific mobile options in the iOS space.
                if (stripos($userAgent, 'iPad') !== false) {
                    $this->device = self::DEVICE_IPAD;
                } elseif (stripos($userAgent, 'iPod') !== false) {
                    $this->device = self::DEVICE_IPOD;
                }

                break;

            case stripos($userAgent, 'iPad') !== false:
                // In case where iPhone is not mentioned in iPad user agent string
                $this->mobile = true;
                $this->device = self::DEVICE_IPAD;

                break;

            case stripos($userAgent, 'iPod') !== false:
                // In case where iPhone is not mentioned in iPod user agent string
                $this->mobile = true;
                $this->device = self::DEVICE_IPOD;

                break;

            case preg_match('/macintosh|mac os x/i', $userAgent):
                // This has to come after the iPhone check because mac strings are also present in iOS devices.
                $this->device = self::DEVICE_MAC;

                break;

            case stripos($userAgent, 'Blackberry') !== false:
                $this->mobile = true;
                $this->device = self::DEVICE_BLACKBERRY;

                break;

            case stripos($userAgent, 'Android') !== false:
                $this->mobile = true;
                $this->device = self::DEVICE_ANDROID;
                /*
                 * Attempt to distinguish between Android phones and tablets
                 * There is no totally foolproof method but certain rules almost always hold
                 * Android 3.x is only used for tablets
                 * Some devices and browsers encourage users to change their UA string to include Tablet.
                 * Google encourages manufacturers to exclude the string Mobile from tablet device UA strings.
                 * In some modes Kindle Android devices include the string Mobile but they include the string Silk.
                 */
                if (stripos($userAgent, 'Android 3') !== false || stripos($userAgent, 'Tablet') !== false
                    || stripos($userAgent, 'Mobile') === false || stripos($userAgent, 'Silk') !== false) {
                    $this->device = self::ANDROID_TABLET;
                }

                break;

            case stripos($userAgent, 'Linux') !== false:
                $this->device = self::DEVICE_LINUX;

                break;
        }

        // Mark this detection routine as run.
        $this->detection['device'] = true;
    }