/** * Determine if the browser is Android. * * @return bool */ public static function checkBrowserAndroid() { // Navigator if (stripos(self::$userAgentString, 'Android') !== false) { if (preg_match('/Version\\/([\\d\\.]*)/i', self::$userAgentString, $matches)) { self::$browser->setVersion($matches[1]); } else { self::$browser->setVersion(Browser::VERSION_UNKNOWN); } self::$browser->setName(Browser::NAVIGATOR); return true; } return false; }
/** * Determine if the browser is Android. * * @param Browser $browser * @param UserAgent $userAgent * @return bool */ private static function checkBrowserAndroid(Browser $browser, UserAgent $userAgent) { // Navigator if (stripos($userAgent->getUserAgentString(), 'Android') !== false) { if (preg_match('/Version\\/([\\d\\.]*)/i', $userAgent->getUserAgentString(), $matches)) { $browser->setVersion($matches[1]); } else { $browser->setVersion($browser::VERSION_UNKNOWN); } $browser->setName($browser::NAVIGATOR); return true; } return false; }