| @@ 121-135 (lines=15) @@ | ||
| 118 | * |
|
| 119 | * @return bool |
|
| 120 | */ |
|
| 121 | private static function checkOSX(Os $os, UserAgent $userAgent) |
|
| 122 | { |
|
| 123 | if (stripos($userAgent->getUserAgentString(), 'OS X') !== false) { |
|
| 124 | $os->setName($os::OSX); |
|
| 125 | if (preg_match('/OS X ([\d\._]*)/i', $userAgent->getUserAgentString(), $matches)) { |
|
| 126 | if (isset($matches[1])) { |
|
| 127 | $os->setVersion(str_replace('_', '.', $matches[1])); |
|
| 128 | } |
|
| 129 | } |
|
| 130 | ||
| 131 | return true; |
|
| 132 | } |
|
| 133 | ||
| 134 | return false; |
|
| 135 | } |
|
| 136 | ||
| 137 | /** |
|
| 138 | * Determine if the user's operating system is Windows. |
|
| @@ 222-236 (lines=15) @@ | ||
| 219 | * |
|
| 220 | * @return bool |
|
| 221 | */ |
|
| 222 | private static function checkWindowsPhone(Os $os, UserAgent $userAgent) |
|
| 223 | { |
|
| 224 | if (stripos($userAgent->getUserAgentString(), 'Windows Phone') !== false) { |
|
| 225 | $os->setName($os::WINDOWS_PHONE); |
|
| 226 | // Windows version |
|
| 227 | if (preg_match('/Windows Phone ([\d\.]*)/i', $userAgent->getUserAgentString(), $matches)) { |
|
| 228 | if (isset($matches[1])) { |
|
| 229 | $os->setVersion((float)$matches[1]); |
|
| 230 | } |
|
| 231 | } |
|
| 232 | ||
| 233 | return true; |
|
| 234 | } |
|
| 235 | return false; |
|
| 236 | } |
|
| 237 | ||
| 238 | /** |
|
| 239 | * Determine if the user's operating system is SymbOS. |
|
| @@ 100-111 (lines=12) @@ | ||
| 97 | * |
|
| 98 | * @return bool |
|
| 99 | */ |
|
| 100 | private static function checkChromeOs(Os $os, UserAgent $userAgent) |
|
| 101 | { |
|
| 102 | if (stripos($userAgent->getUserAgentString(), 'CrOS') !== false) { |
|
| 103 | $os->setName($os::CHROME_OS); |
|
| 104 | if (preg_match('/Chrome\/([\d\.]*)/i', $userAgent->getUserAgentString(), $matches)) { |
|
| 105 | $os->setVersion($matches[1]); |
|
| 106 | } |
|
| 107 | return true; |
|
| 108 | } |
|
| 109 | ||
| 110 | return false; |
|
| 111 | } |
|
| 112 | ||
| 113 | /** |
|
| 114 | * Determine if the user's operating system is OS X. |
|