| @@ 123-137 (lines=15) @@ | ||
| 120 | * | |
| 121 | * @return bool | |
| 122 | */ | |
| 123 | private static function checkOSX(Os $os, UserAgent $userAgent) | |
| 124 |     { | |
| 125 |         if (stripos($userAgent->getUserAgentString(), 'OS X') !== false) { | |
| 126 | $os->setName($os::OSX); | |
| 127 |             if (preg_match('/OS X ([\d\._]*)/i', $userAgent->getUserAgentString(), $matches)) { | |
| 128 |                 if (isset($matches[1])) { | |
| 129 |                     $os->setVersion(str_replace('_', '.', $matches[1])); | |
| 130 | } | |
| 131 | } | |
| 132 | ||
| 133 | return true; | |
| 134 | } | |
| 135 | ||
| 136 | return false; | |
| 137 | } | |
| 138 | ||
| 139 | /** | |
| 140 | * Determine if the user's operating system is Windows. | |
| @@ 224-239 (lines=16) @@ | ||
| 221 | * | |
| 222 | * @return bool | |
| 223 | */ | |
| 224 | private static function checkWindowsPhone(Os $os, UserAgent $userAgent) | |
| 225 |     { | |
| 226 |         if (stripos($userAgent->getUserAgentString(), 'Windows Phone') !== false) { | |
| 227 | $os->setIsMobile(true); | |
| 228 | $os->setName($os::WINDOWS_PHONE); | |
| 229 | // Windows version | |
| 230 |             if (preg_match('/Windows Phone ([\d\.]*)/i', $userAgent->getUserAgentString(), $matches)) { | |
| 231 |                 if (isset($matches[1])) { | |
| 232 | $os->setVersion((float)$matches[1]); | |
| 233 | } | |
| 234 | } | |
| 235 | ||
| 236 | return true; | |
| 237 | } | |
| 238 | return false; | |
| 239 | } | |
| 240 | ||
| 241 | /** | |
| 242 | * Determine if the user's operating system is SymbOS. | |
| @@ 67-79 (lines=13) @@ | ||
| 64 | * @param UserAgent $userAgent | |
| 65 | * @return bool | |
| 66 | */ | |
| 67 | private static function checkWindowsPhone(Device $device, UserAgent $userAgent) | |
| 68 |     { | |
| 69 |         if (stripos($userAgent->getUserAgentString(), 'Windows Phone') !== false) { | |
| 70 |             if (preg_match('/Microsoft; (Lumia [^)]*)\)/', $userAgent->getUserAgentString(), $matches)) { | |
| 71 | $device->setName($matches[1]); | |
| 72 | return true; | |
| 73 | } | |
| 74 | ||
| 75 | $device->setName($device::WINDOWS_PHONE); | |
| 76 | return true; | |
| 77 | } | |
| 78 | return false; | |
| 79 | } | |
| 80 | ||
| 81 | /** | |
| 82 | * Determine if the device is Windows Phone. | |