@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -declare(strict_types = 1); |
|
2 | +declare(strict_types=1); |
|
3 | 3 | namespace hexydec\agentzero; |
4 | 4 | |
5 | 5 | class browsers { |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | */ |
12 | 12 | public static function get() : array { |
13 | 13 | $fn = [ |
14 | - 'browserslash' => function (string $value) : array { |
|
14 | + 'browserslash' => function(string $value) : array { |
|
15 | 15 | if (($browser = \mb_strrchr($value, ' ')) !== false) { |
16 | 16 | $value = \ltrim($browser); |
17 | 17 | } |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | } |
49 | 49 | return $data; |
50 | 50 | }, |
51 | - 'presto' => function (string $value) : array { |
|
51 | + 'presto' => function(string $value) : array { |
|
52 | 52 | $parts = \explode('/', $value, 2); |
53 | 53 | return [ |
54 | 54 | 'type' => 'human', |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | 'engineversion' => $parts[1] ?? null |
59 | 59 | ]; |
60 | 60 | }, |
61 | - 'chromium' => function (string $value) : array { |
|
61 | + 'chromium' => function(string $value) : array { |
|
62 | 62 | $parts = \explode('/', $value, 3); |
63 | 63 | $engineversion = isset($parts[1]) && \strspn($parts[1], '1234567890.') === \strlen($parts[1]) ? $parts[1] : null; |
64 | 64 | return [ |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | 'engineversion' => $engineversion |
70 | 70 | ]; |
71 | 71 | }, |
72 | - 'safari' => function (string $value, int $i, array $tokens) : array { |
|
72 | + 'safari' => function(string $value, int $i, array $tokens) : array { |
|
73 | 73 | $version = null; |
74 | 74 | foreach ($tokens AS $item) { |
75 | 75 | if (\mb_stripos($item, 'Version/') === 0) { |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | 'type' => 'human', |
137 | 137 | 'category' => 'desktop' |
138 | 138 | ]), |
139 | - 'Midori' => new props('start', function (string $value) : array { |
|
139 | + 'Midori' => new props('start', function(string $value) : array { |
|
140 | 140 | $parts = \explode('/', $value, 2); |
141 | 141 | return [ |
142 | 142 | 'type' => 'human', |
@@ -152,14 +152,14 @@ discard block |
||
152 | 152 | 'browserversion' => \mb_substr($value, 7), |
153 | 153 | 'engineversion' => \mb_substr($value, 7) |
154 | 154 | ]), |
155 | - 'Firefox/' => new props('start', function (string $value) use ($fn) : array { |
|
155 | + 'Firefox/' => new props('start', function(string $value) use ($fn) : array { |
|
156 | 156 | $data = $fn['browserslash']($value); |
157 | 157 | return \array_merge($data, [ |
158 | 158 | 'engine' => 'Gecko', |
159 | 159 | 'engineversion' => $data['browserversion'] ?? null |
160 | 160 | ]); |
161 | 161 | }), |
162 | - ' Firefox/' => new props('any', function (string $value) use ($fn) : array { |
|
162 | + ' Firefox/' => new props('any', function(string $value) use ($fn) : array { |
|
163 | 163 | $data = $fn['browserslash']($value); |
164 | 164 | return \array_merge($data, [ |
165 | 165 | 'engine' => 'Gecko', |
@@ -171,13 +171,13 @@ discard block |
||
171 | 171 | 'engine' => 'Gecko', |
172 | 172 | 'browser' => 'Firefox' |
173 | 173 | ]), |
174 | - 'Minimo/' => new props('start', function (string $value) use ($fn) : array { |
|
174 | + 'Minimo/' => new props('start', function(string $value) use ($fn) : array { |
|
175 | 175 | $data = $fn['browserslash']($value); |
176 | 176 | return \array_merge($data, [ |
177 | 177 | 'engine' => 'Gecko' |
178 | 178 | ]); |
179 | 179 | }), |
180 | - 'BonEcho/' => new props('start', function (string $value) use ($fn) : array { |
|
180 | + 'BonEcho/' => new props('start', function(string $value) use ($fn) : array { |
|
181 | 181 | $data = $fn['browserslash']($value); |
182 | 182 | return \array_merge($data, [ |
183 | 183 | 'engine' => 'Gecko' |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | 'browserversion' => \mb_substr($value, 9), |
218 | 218 | 'engine' => 'Trident' |
219 | 219 | ]), |
220 | - 'Trident' => new props('start', [ // infill for missing browser name |
|
220 | + 'Trident' => new props('start', [// infill for missing browser name |
|
221 | 221 | 'browser' => 'Internet Explorer' |
222 | 222 | ]), |
223 | 223 | 'Cronet/' => new props('start', $fn['chromium']), |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -declare(strict_types = 1); |
|
2 | +declare(strict_types=1); |
|
3 | 3 | namespace hexydec\agentzero; |
4 | 4 | |
5 | 5 | class devices { |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | */ |
12 | 12 | public static function get() : array { |
13 | 13 | $fn = [ |
14 | - 'ios' => function (string $value, int $i, array $tokens) : array { |
|
14 | + 'ios' => function(string $value, int $i, array $tokens) : array { |
|
15 | 15 | $version = null; |
16 | 16 | $model = null; |
17 | 17 | |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | 'device' => 'Xbox', |
53 | 53 | 'model' => ($model = \mb_substr($value, 5)) === '' ? null : $model |
54 | 54 | ], |
55 | - 'playstation' => function (string $value) : array { |
|
55 | + 'playstation' => function(string $value) : array { |
|
56 | 56 | $parts = \explode(' ', $value); |
57 | 57 | if (\str_contains($parts[1], '/')) { |
58 | 58 | list($parts[1], $parts[2]) = \explode('/', $parts[1]); |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | 'bits' => 64 |
76 | 76 | ]; |
77 | 77 | }, |
78 | - 'firetablet' => function (string $value) : ?array { |
|
78 | + 'firetablet' => function(string $value) : ?array { |
|
79 | 79 | $model = \explode(' ', $value)[0]; |
80 | 80 | if (\ctype_alpha($model) && \mb_strlen($model) <= 7) { |
81 | 81 | return [ |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | 'vendor' => 'Google', |
192 | 192 | 'platformversion' => \mb_substr($value, 7) |
193 | 193 | ]), |
194 | - 'Apple/' => new props('start', function (string $value) : array { |
|
194 | + 'Apple/' => new props('start', function(string $value) : array { |
|
195 | 195 | $value = \mb_substr($value, 6); |
196 | 196 | $split = \strcspn($value, '0123456789'); |
197 | 197 | $device = \mb_substr($value, 0, $split); |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | 'googleweblight' => new props('exact', [ |
238 | 238 | 'proxy' => 'googleweblight' |
239 | 239 | ]), |
240 | - 'SAMSUNG-' => new props('start', function (string $value) : array { |
|
240 | + 'SAMSUNG-' => new props('start', function(string $value) : array { |
|
241 | 241 | $parts = \explode('/', $value, 2); |
242 | 242 | return [ |
243 | 243 | 'type' => 'human', |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | 'Samsung' => new props('start', fn (string $value) : ?array => \str_starts_with($value, 'SamsungBrowser') ? null : [ |
251 | 251 | 'vendor' => 'Samsung' |
252 | 252 | ]), |
253 | - 'SM-' => new props('start', function (string $value) : array { |
|
253 | + 'SM-' => new props('start', function(string $value) : array { |
|
254 | 254 | $parts = \explode('.', \explode(' ', $value)[0]); |
255 | 255 | return [ |
256 | 256 | 'vendor' => 'Samsung', |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | 'Acer' => new props('start', [ |
262 | 262 | 'vendor' => 'Acer' |
263 | 263 | ]), |
264 | - 'SonyEricsson' => new props('start', function (string $value) : array { |
|
264 | + 'SonyEricsson' => new props('start', function(string $value) : array { |
|
265 | 265 | $parts = \explode('/', $value, 2); |
266 | 266 | return [ |
267 | 267 | 'type' => 'human', |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | 'build' => $parts[1] ?? null |
272 | 272 | ]; |
273 | 273 | }), |
274 | - 'LGE' => new props('exact', function (string $value, int $i, array $tokens) : array { |
|
274 | + 'LGE' => new props('exact', function(string $value, int $i, array $tokens) : array { |
|
275 | 275 | $device = $tokens[++$i] ?? null; |
276 | 276 | $platformversion = empty($tokens[++$i]) ? null : \mb_substr(\explode(' ', $tokens[$i])[0], 5); |
277 | 277 | $build = $tokens[++$i] ?? null; |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | 'vendor' => 'LG' |
285 | 285 | ]; |
286 | 286 | }), |
287 | - 'NOKIA' => new props('start', function (string $value) : array { |
|
287 | + 'NOKIA' => new props('start', function(string $value) : array { |
|
288 | 288 | return \array_merge(devices::getDevice($value), [ |
289 | 289 | 'type' => 'human', |
290 | 290 | 'category' => 'mobile', |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | 'vendor' => 'Tecno', |
309 | 309 | 'model' => \explode(' ', \str_replace('-', ' ', $value), 2)[1] ?? null |
310 | 310 | ]), |
311 | - 'ThinkPad' => new props('start', function (string $value, int $i, array $tokens) : array { |
|
311 | + 'ThinkPad' => new props('start', function(string $value, int $i, array $tokens) : array { |
|
312 | 312 | if (\mb_strpos($tokens[++$i] ?? '', 'Build/') === 0) { |
313 | 313 | $device = \explode('_', \mb_substr($tokens[$i], 6)); |
314 | 314 | } |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | 'build' => $device[2] ?? null |
321 | 321 | ]; |
322 | 322 | }), |
323 | - 'BlackBerry' => new props('start', function (string $value) : array { |
|
323 | + 'BlackBerry' => new props('start', function(string $value) : array { |
|
324 | 324 | $parts = \explode('/', $value); |
325 | 325 | return [ |
326 | 326 | 'type' => 'human', |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | 'model' => \mb_substr($value, 6) |
336 | 336 | ]), |
337 | 337 | 'Build/' => new props('any', fn (string $value) : array => self::getDevice($value)), |
338 | - 'x' => new props('any', function (string $value) : ?array { |
|
338 | + 'x' => new props('any', function(string $value) : ?array { |
|
339 | 339 | $parts = \explode('x', $value); |
340 | 340 | if (!isset($parts[2]) && \is_numeric($parts[0]) && \is_numeric($parts[1]) && !empty($parts[0]) && !empty($parts[1])) { |
341 | 341 | return [ |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -declare(strict_types = 1); |
|
2 | +declare(strict_types=1); |
|
3 | 3 | namespace hexydec\agentzero; |
4 | 4 | |
5 | 5 | class special { |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -declare(strict_types = 1); |
|
2 | +declare(strict_types=1); |
|
3 | 3 | namespace hexydec\agentzero; |
4 | 4 | |
5 | 5 | class frameworks { |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | 'framework' => 'Alamofire', |
27 | 27 | 'frameworkversion' => \explode('/', $value, 3)[1] |
28 | 28 | ]), |
29 | - '.NET CLR ' => new props('start', function (string $value, int $i, array $tokens) : array { |
|
29 | + '.NET CLR ' => new props('start', function(string $value, int $i, array $tokens) : array { |
|
30 | 30 | |
31 | 31 | // find latest version as often specifdies many versions |
32 | 32 | $levels = []; |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -declare(strict_types = 1); |
|
2 | +declare(strict_types=1); |
|
3 | 3 | namespace hexydec\agentzero; |
4 | 4 | |
5 | 5 | class platforms { |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | */ |
12 | 12 | public static function get() : array { |
13 | 13 | $fn = [ |
14 | - 'platformlinux' => function (string $value) : array { |
|
14 | + 'platformlinux' => function(string $value) : array { |
|
15 | 15 | if (!\str_starts_with($value, 'Red Hat/') && ($platform = \mb_strstr($value, ' ', true)) !== false) { |
16 | 16 | $value = $platform; |
17 | 17 | } |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | 'platformversion' => $parts[1] ?? null |
31 | 31 | ]; |
32 | 32 | }, |
33 | - 'platformwindows' => function (string $value) : array { |
|
33 | + 'platformwindows' => function(string $value) : array { |
|
34 | 34 | $mapping = [ |
35 | 35 | '5.0' => '2000', |
36 | 36 | '5.1' => 'XP', |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | 'platformversion' => $mapping[$version] ?? $version |
57 | 57 | ]; |
58 | 58 | }, |
59 | - 'android' => function (string $value, int $i, array $tokens) : array { |
|
59 | + 'android' => function(string $value, int $i, array $tokens) : array { |
|
60 | 60 | $os = \explode(' ', $value, 3); |
61 | 61 | |
62 | 62 | // skip language |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | 'bits' => 32, |
97 | 97 | ]), |
98 | 98 | 'Windows NT ' => new props('any', $fn['platformwindows']), |
99 | - 'Windows Phone' => new props('start', function (string $value) : array { |
|
99 | + 'Windows Phone' => new props('start', function(string $value) : array { |
|
100 | 100 | $version = \mb_substr($value, 14); |
101 | 101 | return [ |
102 | 102 | 'type' => 'human', |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | 'kernel' => \intval($version) >= 8 ? 'Windows NT' : 'Windows CE' |
107 | 107 | ]; |
108 | 108 | }), |
109 | - 'Win98' => new props('start', function (string $value, int $i, array $tokens) : array { |
|
109 | + 'Win98' => new props('start', function(string $value, int $i, array $tokens) : array { |
|
110 | 110 | foreach ($tokens AS $item) { |
111 | 111 | if (\str_starts_with($item, 'PalmSource')) { |
112 | 112 | return []; |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | 'platform' => 'Windows', |
145 | 145 | 'platformversion' => \mb_substr($value, 5) |
146 | 146 | ]), |
147 | - 'Windows' => new props('any', function (string $value, int $i, array $tokens) use ($fn) : array { |
|
147 | + 'Windows' => new props('any', function(string $value, int $i, array $tokens) use ($fn) : array { |
|
148 | 148 | foreach ($tokens AS $item) { |
149 | 149 | if (\str_starts_with($item, 'PalmSource')) { |
150 | 150 | return []; |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | } |
153 | 153 | return $fn['platformwindows']($value); |
154 | 154 | }), |
155 | - 'Mac OS X' => new props('any', function (string $value) : array { |
|
155 | + 'Mac OS X' => new props('any', function(string $value) : array { |
|
156 | 156 | $version = \str_replace('_', '.', \mb_substr($value, \mb_stripos($value, 'Mac OS X') + 9)); |
157 | 157 | $register = $version && \intval(\explode('.', $version)[1] ?? 0) >= 6 ? 64 : null; |
158 | 158 | return [ |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | 'platform' => 'iOS', |
184 | 184 | 'platformversion' => \str_replace('_', '.', \mb_substr($value, 4)) |
185 | 185 | ]), |
186 | - 'CrOS' => new props('start', function (string $value) : array { |
|
186 | + 'CrOS' => new props('start', function(string $value) : array { |
|
187 | 187 | $parts = \explode(' ', $value); |
188 | 188 | return [ |
189 | 189 | 'type' => 'human', |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | 'platform' => 'Kindle', |
199 | 199 | 'platformversion' => \mb_substr($value, 7) |
200 | 200 | ]), |
201 | - 'Tizen' => new props('start', function (string $value) : array { |
|
201 | + 'Tizen' => new props('start', function(string $value) : array { |
|
202 | 202 | $parts = \explode(' ', $value, 2); |
203 | 203 | return [ |
204 | 204 | 'type' => 'human', |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | 'platformversion' => $parts[1] ?? null |
209 | 209 | ]; |
210 | 210 | }), |
211 | - 'KAIOS/' => new props('start', function (string $value, int $i, array $tokens) : array { |
|
211 | + 'KAIOS/' => new props('start', function(string $value, int $i, array $tokens) : array { |
|
212 | 212 | |
213 | 213 | // find device |
214 | 214 | foreach ($tokens AS $i => $item) { |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | 'kernel' => 'unix', |
282 | 282 | 'platform' => 'Solaris', |
283 | 283 | ]), |
284 | - 'AmigaOS' => new props('any', function (string $value) : array { |
|
284 | + 'AmigaOS' => new props('any', function(string $value) : array { |
|
285 | 285 | if (($pos = \mb_stripos($value, 'AmigaOS')) !== false) { |
286 | 286 | $value = \mb_substr($value, $pos); |
287 | 287 | } |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | 'platformversion' => isset($parts[1]) && \strspn($parts[1], '0123456789.-_') === \strlen($parts[1]) ? $parts[1] : null |
295 | 295 | ]; |
296 | 296 | }), |
297 | - 'Fuchsia' => new props('exact', function (string $value, int $i, array $tokens) : array { |
|
297 | + 'Fuchsia' => new props('exact', function(string $value, int $i, array $tokens) : array { |
|
298 | 298 | $os = \explode(' ', $tokens[++$i], 2); |
299 | 299 | return [ |
300 | 300 | 'type' => 'human', |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | 'platformversion' => isset($os[1]) && \strspn($os[1], '0123456789.-_', \strlen($os[0])) === \strlen($os[1]) ? $os[1] : null |
305 | 305 | ]; |
306 | 306 | }), |
307 | - 'Maemo' => new props('exact', function (string $value, int $i, array $tokens) : array { |
|
307 | + 'Maemo' => new props('exact', function(string $value, int $i, array $tokens) : array { |
|
308 | 308 | $os = \explode(' ', $tokens[++$i], 2); |
309 | 309 | return [ |
310 | 310 | 'type' => 'human', |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | 'kernel' => 'Java VM', |
321 | 321 | 'platform' => $value |
322 | 322 | ]), |
323 | - 'Haiku' => new props('any', function (string $value) : array { |
|
323 | + 'Haiku' => new props('any', function(string $value) : array { |
|
324 | 324 | $parts = \explode('/', $value, 2); |
325 | 325 | return [ |
326 | 326 | 'type' => 'human', |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | 'platformversion' => $parts[1] ?? null |
331 | 331 | ]; |
332 | 332 | }), |
333 | - 'BeOS' => new props('start', function (string $value) : array { |
|
333 | + 'BeOS' => new props('start', function(string $value) : array { |
|
334 | 334 | $parts = \explode('/', $value, 2); |
335 | 335 | return [ |
336 | 336 | 'type' => 'human', |
@@ -342,14 +342,14 @@ discard block |
||
342 | 342 | }), |
343 | 343 | 'Android' => new props('exact', $fn['android']), |
344 | 344 | 'Android ' => new props('start', $fn['android']), |
345 | - 'Linux' => new props('any', function (string $value, int $i, array $tokens) : array { |
|
345 | + 'Linux' => new props('any', function(string $value, int $i, array $tokens) : array { |
|
346 | 346 | return [ |
347 | 347 | 'kernel' => 'Linux', |
348 | 348 | 'platform' => 'Linux', |
349 | 349 | 'platformversion' => \str_contains($tokens[$i + 1] ?? '', '.') && \strspn($tokens[$i + 1], '0123456789.') >= 3 ? \explode(' ', $tokens[$i + 1])[0] : null |
350 | 350 | ]; |
351 | 351 | }), |
352 | - 'X11' => new props('exact', function (string $value, int $i, array $tokens) : array { |
|
352 | + 'X11' => new props('exact', function(string $value, int $i, array $tokens) : array { |
|
353 | 353 | $os = \explode(' ', $tokens[++$i] ?? '', 2); |
354 | 354 | return [ |
355 | 355 | 'category' => 'desktop', |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -declare(strict_types = 1); |
|
2 | +declare(strict_types=1); |
|
3 | 3 | namespace hexydec\agentzero; |
4 | 4 | |
5 | 5 | class apps { |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | */ |
12 | 12 | public static function get() : array { |
13 | 13 | $fn = [ |
14 | - 'appslash' => function (string $value, int $i, array $tokens, string $match) : array { |
|
14 | + 'appslash' => function(string $value, int $i, array $tokens, string $match) : array { |
|
15 | 15 | if (\mb_stripos($value, 'AppleWebKit') === false && !\str_contains($value, '://')) { |
16 | 16 | $parts = \explode('/', $value, 4); |
17 | 17 | $offset = isset($parts[2]) ? 1 : 0; |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | }, |
29 | 29 | ]; |
30 | 30 | return [ |
31 | - 'com.google.' => new props('start', function (string $value) : array { |
|
31 | + 'com.google.' => new props('start', function(string $value) : array { |
|
32 | 32 | $parts = \explode('/', $value, 3); |
33 | 33 | return [ |
34 | 34 | 'type' => 'human', |
@@ -37,14 +37,14 @@ discard block |
||
37 | 37 | 'appversion' => $parts[1] ?? null |
38 | 38 | ]; |
39 | 39 | }), |
40 | - 'OcIdWebView' => new props('exact', function (string $value) : array { |
|
40 | + 'OcIdWebView' => new props('exact', function(string $value) : array { |
|
41 | 41 | $data = [ |
42 | 42 | 'app' => 'Google App Web View', |
43 | 43 | 'appname' => $value |
44 | 44 | ]; |
45 | 45 | return $data; |
46 | 46 | }), |
47 | - 'Instagram' => new props('any', function (string $value, int $i, array $tokens) : array { |
|
47 | + 'Instagram' => new props('any', function(string $value, int $i, array $tokens) : array { |
|
48 | 48 | $parts = \explode(' ', $value, 4); |
49 | 49 | $data = [ |
50 | 50 | 'type' => 'human', |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | 'app' => 'WeChat', |
136 | 136 | 'appname' => 'MicroMessenger' |
137 | 137 | ]), |
138 | - 'weibo' => new props('any', function (string $value) : array { |
|
138 | + 'weibo' => new props('any', function(string $value) : array { |
|
139 | 139 | $data = [ |
140 | 140 | 'app' => 'Weibo', |
141 | 141 | 'appname' => 'Weibo' |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | }), |
153 | 153 | |
154 | 154 | // special parser for Facebook app because it is completely different to any other |
155 | - 'FBAN/' => new props('any', function (string $value) : array { |
|
155 | + 'FBAN/' => new props('any', function(string $value) : array { |
|
156 | 156 | $map = [ |
157 | 157 | 'FBAN/MessengerLiteForiOS' => [ |
158 | 158 | 'type' => 'human', |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | 'FBMD/' => new props('start', fn (string $value) : array => [ |
208 | 208 | 'model' => \mb_substr($value, 5) |
209 | 209 | ]), |
210 | - 'FBDM/' => new props('start', function (string $value) : array { |
|
210 | + 'FBDM/' => new props('start', function(string $value) : array { |
|
211 | 211 | $data = []; |
212 | 212 | foreach (\explode(',', \trim(\mb_substr($value, 5), '{}')) AS $item) { |
213 | 213 | $parts = \explode('=', $item); |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | 'FBSV' => new props('start', fn (string $value) : array => [ |
236 | 236 | 'platformversion' => \mb_substr($value, 5) |
237 | 237 | ]), |
238 | - 'isDarkMode/' => new props('start', function (string $value) : array { |
|
238 | + 'isDarkMode/' => new props('start', function(string $value) : array { |
|
239 | 239 | $mode = \mb_substr($value, 11); |
240 | 240 | return [ |
241 | 241 | 'darkmode' => \in_array($mode, ['0', '1'], true) ? \boolval($mode) : null |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | 'NetType/' => new props('start', fn (string $value) : array => [ |
248 | 248 | 'nettype' => \mb_convert_case(\mb_substr($value, 8), MB_CASE_UPPER) |
249 | 249 | ]), |
250 | - 'Microsoft Office' => new props('start', function (string $value, int $i, array $tokens) : array { |
|
250 | + 'Microsoft Office' => new props('start', function(string $value, int $i, array $tokens) : array { |
|
251 | 251 | $data = [ |
252 | 252 | 'type' => 'human' |
253 | 253 | ]; |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -declare(strict_types = 1); |
|
2 | +declare(strict_types=1); |
|
3 | 3 | namespace hexydec\agentzero; |
4 | 4 | |
5 | 5 | class crawlers { |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | 'category' => 'feed' |
218 | 218 | ] |
219 | 219 | )), |
220 | - 'crawler' => function (string $value) : array { |
|
220 | + 'crawler' => function(string $value) : array { |
|
221 | 221 | return self::getApp($value, ['category' => 'crawler']); |
222 | 222 | }, |
223 | 223 | 'monitor' => fn (string $value) : array => self::getApp($value, ['category' => 'monitor']), |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | 'type' => 'robot', |
230 | 230 | 'categpry' => 'scraper' |
231 | 231 | ]), |
232 | - 'Moblie' => new props('exact', [ // some samsung devices mispelt it |
|
232 | + 'Moblie' => new props('exact', [// some samsung devices mispelt it |
|
233 | 233 | 'type' => 'robot', |
234 | 234 | 'category' => 'scraper' |
235 | 235 | ]), |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | 'Siteimprove.com' => new props('any', $fn['crawler']), |
255 | 255 | 'SEOlyt/' => new props('any', $fn['crawler']), |
256 | 256 | 'CyotekWebCopy' => new props('start', $fn['scraper']), |
257 | - 'Yandex' => new props('start', function (string $value) : array { |
|
257 | + 'Yandex' => new props('start', function(string $value) : array { |
|
258 | 258 | $parts = \explode('/', $value, 3); |
259 | 259 | return [ |
260 | 260 | 'type' => 'robot', |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | ]; |
266 | 266 | }), |
267 | 267 | 'Google Page Speed Insights' => new props('exact', $fn['validator']), |
268 | - 'Qwantify' => new props('start', function (string $value) : array { |
|
268 | + 'Qwantify' => new props('start', function(string $value) : array { |
|
269 | 269 | $parts = \explode('/', $value, 3); |
270 | 270 | return [ |
271 | 271 | 'type' => 'robot', |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | 'HostTracker/' => new props('start', $fn['monitor']), |
317 | 317 | 'NCSC Web Check [email protected]' => new props('exact', $fn['monitor']), |
318 | 318 | 'Enhanced WebCheck [email protected]' => new props('exact', $fn['monitor']), |
319 | - 'Pingdom.com' => new props('start', function (string $value) : array { |
|
319 | + 'Pingdom.com' => new props('start', function(string $value) : array { |
|
320 | 320 | $version = \explode('_', \trim($value, '_')); |
321 | 321 | return [ |
322 | 322 | 'type' => 'robot', |
@@ -346,14 +346,14 @@ discard block |
||
346 | 346 | 'Embedly/' => new props('start', $fn['feed']), |
347 | 347 | 'PayPal IPN' => new props('exact', $fn['feed']), |
348 | 348 | 'DropboxPreviewBot/' => new props('start', $fn['feed']), |
349 | - 'Pleroma' => new props('start', fn (string $value) : array => [ // mastodon |
|
349 | + 'Pleroma' => new props('start', fn (string $value) : array => [// mastodon |
|
350 | 350 | 'type' => 'robot', |
351 | 351 | 'category' => 'feed', |
352 | 352 | 'app' => 'Mastodon', |
353 | 353 | 'appname' => 'Pleroma', |
354 | 354 | 'appversion' => \mb_substr($value, 8) |
355 | 355 | ]), |
356 | - 'Outlook-Android/' => new props('start', fn (string $value) : array => [ // mastodon |
|
356 | + 'Outlook-Android/' => new props('start', fn (string $value) : array => [// mastodon |
|
357 | 357 | 'type' => 'robot', |
358 | 358 | 'category' => 'feed', |
359 | 359 | 'app' => 'Outlook', |
@@ -361,13 +361,13 @@ discard block |
||
361 | 361 | 'platform' => 'Android', |
362 | 362 | 'appversion' => \mb_substr($value, 16) |
363 | 363 | ]), |
364 | - 'Outlook-iOS/' => new props('start', fn (string $value, int $i, array $tokens) : array => [ // mastodon |
|
364 | + 'Outlook-iOS/' => new props('start', fn (string $value, int $i, array $tokens) : array => [// mastodon |
|
365 | 365 | 'type' => 'robot', |
366 | 366 | 'category' => 'feed', |
367 | 367 | 'app' => 'Outlook', |
368 | 368 | 'appname' => 'Outlook-iOS', |
369 | 369 | 'platform' => 'iOS', |
370 | - 'appversion' => $tokens[$i+1] ?? \mb_substr($value, 12) |
|
370 | + 'appversion' => $tokens[$i + 1] ?? \mb_substr($value, 12) |
|
371 | 371 | ]), |
372 | 372 | 'OutlookMobileCloudService-Autodetect/' => new props('start', fn (string $value) : array => [ |
373 | 373 | 'type' => 'robot', |
@@ -376,12 +376,12 @@ discard block |
||
376 | 376 | 'appname' => 'OutlookMobileCloudService-Autodetect', |
377 | 377 | 'appversion' => \mb_substr($value, 37) |
378 | 378 | ]), |
379 | - 'HubSpot Connect ' => new props('start', function (string $value, int $i, array $tokens) : array { |
|
379 | + 'HubSpot Connect ' => new props('start', function(string $value, int $i, array $tokens) : array { |
|
380 | 380 | $app = 'HubSpot Connect'; |
381 | 381 | $count = \count($tokens); |
382 | 382 | for ($n = $i; $n < $count; $n++) { |
383 | 383 | if (\str_starts_with($tokens[$n], 'namespace: ')) { |
384 | - $app = \mb_substr($tokens[$n], 11).' - '.$tokens[$n+1]; |
|
384 | + $app = \mb_substr($tokens[$n], 11).' - '.$tokens[$n + 1]; |
|
385 | 385 | break; |
386 | 386 | } |
387 | 387 | } |
@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | 'type' => 'robot', |
413 | 413 | 'category' => 'feed', |
414 | 414 | 'app' => 'Google Docs', |
415 | - 'appname' => $value.'; '.$tokens[$i+1] |
|
415 | + 'appname' => $value.'; '.$tokens[$i + 1] |
|
416 | 416 | ]), |
417 | 417 | 'Google-Lens' => new props('exact', $fn['feed']), |
418 | 418 | 'ManicTime/' => new props('start', $fn['feed']), |