示例#1
0
 /**
  * Routine to determine the browser type.
  *
  * @param Browser $browser
  * @param UserAgent $userAgent
  *
  * @return bool
  */
 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();
     foreach (self::$browsersList as $browserName) {
         $funcName = self::FUNC_PREFIX . $browserName;
         if (self::$funcName()) {
             return true;
         }
     }
     return false;
 }