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