/** * Determine if the device is Iphone. * * @return bool */ public function checkIphone() { if (stripos($this->userAgent->getUserAgentString(), 'iphone;') !== false) { $this->device->setName(Device::IPHONE); return true; } return false; }
/** * Determine if the device is Windows Phone. * * @param Device $device * @param UserAgent $userAgent * @return bool */ private static function checkWindowsPhone(Device $device, UserAgent $userAgent) { if (stripos($userAgent->getUserAgentString(), 'Windows Phone') !== false) { $device->setName($device::WINDOWS_PHONE); 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; }
/** * Determine if the user's operating system is BeOS. * * @param Os $os * @param UserAgent $userAgent * * @return bool */ private static function checkBeOS(Os $os, UserAgent $userAgent) { if (stripos($userAgent->getUserAgentString(), 'BeOS') !== false) { $os->setVersion($os::VERSION_UNKNOWN); $os->setName($os::BEOS); return true; } return false; }