@@ -97,7 +97,7 @@ |
||
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | if (!empty($locale)) { |
| 100 | - return $userLanguage . $separator . strtoupper($locale); |
|
| 100 | + return $userLanguage.$separator.strtoupper($locale); |
|
| 101 | 101 | } else { |
| 102 | 102 | return $userLanguage; |
| 103 | 103 | } |
@@ -75,7 +75,7 @@ |
||
| 75 | 75 | */ |
| 76 | 76 | public function setName($name) |
| 77 | 77 | { |
| 78 | - $this->name = (string)$name; |
|
| 78 | + $this->name = (string) $name; |
|
| 79 | 79 | |
| 80 | 80 | return $this; |
| 81 | 81 | } |
@@ -26,7 +26,7 @@ |
||
| 26 | 26 | */ |
| 27 | 27 | public function setUserAgentString($userAgentString) |
| 28 | 28 | { |
| 29 | - $this->userAgentString = (string)$userAgentString; |
|
| 29 | + $this->userAgentString = (string) $userAgentString; |
|
| 30 | 30 | |
| 31 | 31 | return $this; |
| 32 | 32 | } |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | */ |
| 88 | 88 | public function setName($name) |
| 89 | 89 | { |
| 90 | - $this->name = (string)$name; |
|
| 90 | + $this->name = (string) $name; |
|
| 91 | 91 | |
| 92 | 92 | return $this; |
| 93 | 93 | } |
@@ -100,11 +100,11 @@ discard block |
||
| 100 | 100 | public function getVersion() |
| 101 | 101 | { |
| 102 | 102 | if (isset($this->version)) { |
| 103 | - return (string)$this->version; |
|
| 103 | + return (string) $this->version; |
|
| 104 | 104 | } else { |
| 105 | 105 | OsDetector::detect($this, $this->getUserAgent()); |
| 106 | 106 | |
| 107 | - return (string)$this->version; |
|
| 107 | + return (string) $this->version; |
|
| 108 | 108 | } |
| 109 | 109 | } |
| 110 | 110 | |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | */ |
| 118 | 118 | public function setVersion($version) |
| 119 | 119 | { |
| 120 | - $this->version = (string)$version; |
|
| 120 | + $this->version = (string) $version; |
|
| 121 | 121 | |
| 122 | 122 | return $this; |
| 123 | 123 | } |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | */ |
| 152 | 152 | public function setIsMobile($isMobile = true) |
| 153 | 153 | { |
| 154 | - $this->isMobile = (bool)$isMobile; |
|
| 154 | + $this->isMobile = (bool) $isMobile; |
|
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | /** |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | $os->setVersion('NT 4.0'); |
| 175 | 175 | break; |
| 176 | 176 | default: |
| 177 | - if ((float)$matches[1] >= 10.0) { |
|
| 177 | + if ((float) $matches[1] >= 10.0) { |
|
| 178 | 178 | $os->setVersion($matches[1]); |
| 179 | 179 | } |
| 180 | 180 | break; |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | // Windows version |
| 227 | 227 | if (preg_match('/Windows Phone ([\d\.]*)/i', $userAgent->getUserAgentString(), $matches)) { |
| 228 | 228 | if (isset($matches[1])) { |
| 229 | - $os->setVersion((float)$matches[1]); |
|
| 229 | + $os->setVersion((float) $matches[1]); |
|
| 230 | 230 | } |
| 231 | 231 | } |
| 232 | 232 | |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | $aresult = explode('Version/10.', $userAgent->getUserAgentString()); |
| 316 | 316 | if (isset($aresult[1])) { |
| 317 | 317 | $aversion = explode(' ', $aresult[1]); |
| 318 | - $os->setVersion('10.' . $aversion[0]); |
|
| 318 | + $os->setVersion('10.'.$aversion[0]); |
|
| 319 | 319 | } else { |
| 320 | 320 | $os->setVersion('10'); |
| 321 | 321 | } |
@@ -75,7 +75,7 @@ |
||
| 75 | 75 | self::$scriptedAgent->setInfoURL(ScriptedAgent::UNKNOWN); |
| 76 | 76 | |
| 77 | 77 | foreach (self::$robotsList as $robotName) { |
| 78 | - $funcName = self::FUNC_PREFIX . $robotName; |
|
| 78 | + $funcName = self::FUNC_PREFIX.$robotName; |
|
| 79 | 79 | |
| 80 | 80 | if (self::$funcName()) { |
| 81 | 81 | return true; |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | */ |
| 101 | 101 | public function setName($name) |
| 102 | 102 | { |
| 103 | - $this->name = (string)$name; |
|
| 103 | + $this->name = (string) $name; |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | /** |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | */ |
| 127 | 127 | public function setType($type) |
| 128 | 128 | { |
| 129 | - $this->type = (string)$type; |
|
| 129 | + $this->type = (string) $type; |
|
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | /** |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | */ |
| 153 | 153 | public function setInfoURL($url) |
| 154 | 154 | { |
| 155 | - $this->url = (string)$url; |
|
| 155 | + $this->url = (string) $url; |
|
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | /** |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | */ |
| 110 | 110 | public function setName($name) |
| 111 | 111 | { |
| 112 | - $this->name = (string)$name; |
|
| 112 | + $this->name = (string) $name; |
|
| 113 | 113 | return $this; |
| 114 | 114 | } |
| 115 | 115 | |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | */ |
| 147 | 147 | public function setVersion($version) |
| 148 | 148 | { |
| 149 | - $this->version = (string)$version; |
|
| 149 | + $this->version = (string) $version; |
|
| 150 | 150 | return $this; |
| 151 | 151 | } |
| 152 | 152 | |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | (stripos($ua, 'Chrome/51.0.2704.103') !== false && !isset($_SERVER['HTTP_UPGRADE_INSECURE_REQUESTS']) && stristr($_SERVER['HTTP_ACCEPT_LANGUAGE'], "ru-RU") !== false) //ICQ Preview |
| 213 | 213 | ) { |
| 214 | 214 | $scriptedAgent = new ScriptedAgent($ua); |
| 215 | - if ($scriptedAgent->getName()==ScriptedAgent::UNKNOWN) { |
|
| 215 | + if ($scriptedAgent->getName() == ScriptedAgent::UNKNOWN) { |
|
| 216 | 216 | return false; |
| 217 | 217 | } else { |
| 218 | 218 | return $scriptedAgent; |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | */ |
| 229 | 229 | public function setIsChromeFrame($isChromeFrame) |
| 230 | 230 | { |
| 231 | - $this->isChromeFrame = (bool)$isChromeFrame; |
|
| 231 | + $this->isChromeFrame = (bool) $isChromeFrame; |
|
| 232 | 232 | return $this; |
| 233 | 233 | } |
| 234 | 234 | |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | */ |
| 261 | 261 | public function setIsWebkit($isWebkit) |
| 262 | 262 | { |
| 263 | - $this->isWebkit = (bool)$isWebkit; |
|
| 263 | + $this->isWebkit = (bool) $isWebkit; |
|
| 264 | 264 | return $this; |
| 265 | 265 | } |
| 266 | 266 | |
@@ -96,6 +96,9 @@ discard block |
||
| 96 | 96 | return $siblingVersions; |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | + /** |
|
| 100 | + * @param string $content |
|
| 101 | + */ |
|
| 99 | 102 | private static function fetchEdgeVersion($content) |
| 100 | 103 | { |
| 101 | 104 | preg_match('/<h4[^>]*> *Edge ([\d\.]*) *<\/h4>/', $content, $edge); |
@@ -107,6 +110,10 @@ discard block |
||
| 107 | 110 | return null; |
| 108 | 111 | } |
| 109 | 112 | |
| 113 | + /** |
|
| 114 | + * @param string $edgeHtml |
|
| 115 | + * @param string $edge |
|
| 116 | + */ |
|
| 110 | 117 | private static function writeEdgeVersion($edgeHtml, $edge) |
| 111 | 118 | { |
| 112 | 119 | $file = __DIR__ . '/../../src/edgeVersionMap.php'; |
@@ -130,6 +137,9 @@ discard block |
||
| 130 | 137 | } |
| 131 | 138 | } |
| 132 | 139 | |
| 140 | + /** |
|
| 141 | + * @param string $content |
|
| 142 | + */ |
|
| 133 | 143 | private static function fetchSiblingVersions($content) |
| 134 | 144 | { |
| 135 | 145 | if (!$content) { |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | |
| 19 | 19 | public static function fetchVersions() |
| 20 | 20 | { |
| 21 | - $windowsVersions = json_decode(file_get_contents(__DIR__ . '/windowsVersions.json'), true); |
|
| 21 | + $windowsVersions = json_decode(file_get_contents(__DIR__.'/windowsVersions.json'), true); |
|
| 22 | 22 | if (!count($windowsVersions)) { |
| 23 | 23 | $currentVersion = explode('.', self::fetchCurrentVersion(), 2); |
| 24 | 24 | if (!isset($currentVersion[0])) { |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | private static function writeWindowsVersions($windowsVersions) |
| 64 | 64 | { |
| 65 | 65 | ksort($windowsVersions); |
| 66 | - file_put_contents(__DIR__ . '/windowsVersions.json', json_encode($windowsVersions, JSON_PRETTY_PRINT)); |
|
| 66 | + file_put_contents(__DIR__.'/windowsVersions.json', json_encode($windowsVersions, JSON_PRETTY_PRINT)); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | private static function fetchCurrentVersion() |
@@ -109,14 +109,14 @@ discard block |
||
| 109 | 109 | |
| 110 | 110 | private static function writeEdgeVersion($edgeHtml, $edge) |
| 111 | 111 | { |
| 112 | - $file = __DIR__ . '/../../src/edgeVersionMap.php'; |
|
| 112 | + $file = __DIR__.'/../../src/edgeVersionMap.php'; |
|
| 113 | 113 | $currentVersions = require $file; |
| 114 | 114 | if (!isset($currentVersions[$edgeHtml])) { |
| 115 | 115 | $currentVersions[$edgeHtml] = $edge; |
| 116 | 116 | ksort($currentVersions); |
| 117 | 117 | $content = ''; |
| 118 | 118 | foreach ($currentVersions as $edgeHtml => $edge) { |
| 119 | - $content .= " '{$edgeHtml}' => '{$edge}'," . PHP_EOL; |
|
| 119 | + $content .= " '{$edgeHtml}' => '{$edge}',".PHP_EOL; |
|
| 120 | 120 | } |
| 121 | 121 | $data = <<<PHP |
| 122 | 122 | <?php |