Get the device name.

@param  string|null  $userAgent

@return string
764768
public function device($userAgent = null)
    {
        // Get device rules
        $rules = $this->mergeRules(
            static::$additionalDevices, // NEW
            static::$phoneDevices,
            static::$tabletDevices,
            static::$utilities
        );

        return $this->findDetectionRulesAgainstUA($rules, $userAgent);
    }
791191
private function getClientBrowserOperatingSystem(\DeviceDetector\DeviceDetector $deviceDetectorClass, $userAgent)
    {
        $aReturn                 = $deviceDetectorClass->getOs();
        $aReturn['architecture'] = $this->getArchitectureFromUserAgent($userAgent, 'os');
        $operatingSystem         = new \DeviceDetector\Parser\OperatingSystem();
        $osFamily                = $operatingSystem->getOsFamily($deviceDetectorClass->getOs('short_name'));
        $aReturn['family']       = ($osFamily !== false ? $osFamily : 'Unknown');
        ksort($aReturn);
        return $aReturn;
    }
409232
public function applyConclusiveMatch($userAgent)
    {
        $tolerance = Utils::firstSpace($userAgent);

        return $this->getDeviceIDFromRIS($userAgent, $tolerance);
    }
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;
	}
266605
protected function getBrowserId(string $userAgent) : int
    {
        if ($this->browserId === null) {
            $this->findBrowser($userAgent);
        }

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

        return false;
    }
780993
public function applyRecoveryMatch($userAgent)
    {
        $tolerance = Utils::indexOfOrLength($userAgent, '/', strpos($userAgent, 'Samsung'));

        return $this->getDeviceIDFromRIS($userAgent, $tolerance);
    }
1247376
public function normalize($userAgent)
    {
        if (Utils::checkIfContainsAnyOf($userAgent, array('WPDesktop', 'ZuneWP7'))
            || Utils::checkIfContainsAll($userAgent, array('Mozilla/5.0 (Windows NT ', ' ARM;', ' Edge/'))
        ) {
            $model   = WindowsPhoneHandler::getWindowsPhoneDesktopModel($userAgent);
            $version = WindowsPhoneHandler::getWindowsPhoneDesktopVersion($userAgent);
        } elseif (Utils::checkIfStartsWithAnyOf($userAgent, array('Windows Phone Ad Client', 'WindowsPhoneAdClient'))) {
            $model   = WindowsPhoneHandler::getWindowsPhoneAdClientModel($userAgent);
            $version = WindowsPhoneHandler::getWindowsPhoneVersion($userAgent);
        } elseif (Utils::checkIfContains($userAgent, 'NativeHost')) {
            return $userAgent;
        } else {
            $model   = WindowsPhoneHandler::getWindowsPhoneModel($userAgent);
            $version = WindowsPhoneHandler::getWindowsPhoneVersion($userAgent);
        }

        if ($model !== null && $version !== null) {
            // 'WP' is for Windows Phone
            $prefix = 'WP' . $version . ' ' . $model . WurflConstants::RIS_DELIMITER;

            return $prefix . $userAgent;
        }

        return $userAgent;
    }
1008399
public function applyConclusiveMatch($userAgent)
    {
        $operaIndex = strpos($userAgent, 'Opera');
        $tolerance  = Utils::indexOfOrLength($userAgent, '.', $operaIndex);

        return $this->getDeviceIDFromRIS($userAgent, $tolerance);
    }
968430
public static function getHTCMacModel($userAgent)
    {
        if (preg_match('/(HTC[^;\)]+)/', $userAgent, $matches)) {
            $model = preg_replace('#[ _\-/]#', '~', $matches[1]);

            return $model;
        }

        return null;
    }
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;
    }
930568
public static function getWindowsPhoneVersion($userAgent)
    {
        if (preg_match('|Windows ?Phone(?: ?OS)? ?(\d+\.\d+)|', $userAgent, $matches)) {
            if (strpos($matches[1], '10.0') !== false) {
                return '10.0';
            } elseif (strpos($matches[1], '6.3') !== false || strpos($matches[1], '8.1') !== false) {
                return '8.1';
            } elseif (strpos($matches[1], '8.') !== false) {
                return '8.0';
            } elseif (strpos($matches[1], '7.8') !== false) {
                return '7.8';
            } elseif (strpos($matches[1], '7.10') !== false || strpos($matches[1], '7.5') !== false) {
                return '7.5';
            } elseif (strpos($matches[1], '6.5') !== false) {
                return '6.5';
            } else {
                return '7.0';
            }
        }

        return null;
    }
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;
    }
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);
    }
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;
    }
554494
public function normalize($userAgent)
    {
        $model = HTCMacHandler::getHTCMacModel($userAgent, false);

        if ($model !== null) {
            $prefix = $model . WurflConstants::RIS_DELIMITER;

            return $prefix . $userAgent;
        }

        return $userAgent;
    }
1021165
public function applyConclusiveMatch($userAgent)
    {
        //High accuracy mode
        $tolerance = Utils::firstCloseParen($userAgent);

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