Test Failed
Push — main ( 5139df...d6eca2 )
by Will
03:38
created
src/mappings/frameworks.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
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
 block discarded – undo
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 = [];
Please login to merge, or discard this patch.
src/mappings/crawlers.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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']),
Please login to merge, or discard this patch.
src/mappings/urls.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types = 1);
2
+declare(strict_types=1);
3 3
 namespace hexydec\agentzero;
4 4
 
5 5
 class urls {
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 	 * @return array<string,props> An array with keys representing the string to match, and values a props object defining how to generate the match and which properties to set
11 11
 	 */
12 12
 	public static function get() : array {
13
-		$fn = function (string $value, int $i, array $tokens) : ?array {
13
+		$fn = function(string $value, int $i, array $tokens) : ?array {
14 14
 			if (($start = \stripos($value, 'http://')) === false) {
15 15
 				if (($start = \stripos($value, 'https://')) === false) {
16 16
 					$start = \stripos($value, 'www.');
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 			'https://' => new props('any', $fn),
33 33
 			'www.' => new props('start', $fn),
34 34
 			'.com' => new props('any', $fn),
35
-			'.' => new props('any', function (string $value) : ?array {
35
+			'.' => new props('any', function(string $value) : ?array {
36 36
 				foreach (\explode(' ', $value) AS $item) {
37 37
 					if (!\str_starts_with($item, 'com.') && \substr_count($item, '.') >= 2) {
38 38
 						foreach (\explode('.', $item) AS $part) {
Please login to merge, or discard this patch.
src/mappings/devices.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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 [
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 				'vendor' => 'Google',
193 193
 				'platformversion' => \mb_substr($value, 7)
194 194
 			]),
195
-			'Apple/' => new props('start', function (string $value) : array {
195
+			'Apple/' => new props('start', function(string $value) : array {
196 196
 				$value = \mb_substr($value, 6);
197 197
 				$split = \strcspn($value, '0123456789');
198 198
 				$device = \mb_substr($value, 0, $split);
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 			'googleweblight' => new props('exact', [
239 239
 				'proxy' => 'googleweblight'
240 240
 			]),
241
-			'SAMSUNG-' => new props('start', function (string $value) : array {
241
+			'SAMSUNG-' => new props('start', function(string $value) : array {
242 242
 				$parts = \explode('/', $value, 2);
243 243
 				return [
244 244
 					'type' => 'human',
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 			'Samsung' => new props('start', fn (string $value) : ?array => \str_starts_with($value, 'SamsungBrowser') ? null : [
252 252
 				'vendor' => 'Samsung'
253 253
 			]),
254
-			'SM-' => new props('start', function (string $value) : array {
254
+			'SM-' => new props('start', function(string $value) : array {
255 255
 				$parts = \explode('.', \explode(' ', $value)[0]);
256 256
 				return [
257 257
 					'vendor' => 'Samsung',
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
 			'Acer' => new props('start', [
263 263
 				'vendor' => 'Acer'
264 264
 			]),
265
-			'SonyEricsson' => new props('start', function (string $value) : array {
265
+			'SonyEricsson' => new props('start', function(string $value) : array {
266 266
 				$parts = \explode('/', $value, 2);
267 267
 				return [
268 268
 					'type' => 'human',
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 					'build' => $parts[1] ?? null
273 273
 				];
274 274
 			}),
275
-			'LGE' => new props('exact', function (string $value, int $i, array $tokens) : array {
275
+			'LGE' => new props('exact', function(string $value, int $i, array $tokens) : array {
276 276
 				$device = $tokens[++$i] ?? null;
277 277
 				$platformversion = empty($tokens[++$i]) ? null : \mb_substr(\explode(' ', $tokens[$i])[0], 5);
278 278
 				$build = $tokens[++$i] ?? null;
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
 					'vendor' => 'LG'
286 286
 				];
287 287
 			}),
288
-			'LG-' => new props('start', function (string $value) : array {
288
+			'LG-' => new props('start', function(string $value) : array {
289 289
 				$parts = \explode('/', \mb_substr($value, 3), 3);
290 290
 				return [
291 291
 					'type' => 'human',
@@ -317,16 +317,16 @@  discard block
 block discarded – undo
317 317
 				'vendor' => 'Tecno',
318 318
 				'model' => \explode(' ', \str_replace('-', ' ', $value), 2)[1] ?? null
319 319
 			]),
320
-			'Xiaomi' => new props('start', function (string $value, int $i, array $tokens) : array {
320
+			'Xiaomi' => new props('start', function(string $value, int $i, array $tokens) : array {
321 321
 				return [
322 322
 					'type' => 'human',
323 323
 					'vendor' => 'Xiaomi',
324 324
 					'device' => \mb_stripos($value, 'Poco') !== false ? 'Poco' : null,
325 325
 					'model' => \mb_stripos($value, 'Xiaomi-Mi') !== 0 ? (\explode(' ', $value)[1] ?? null) : null,
326
-					'platformversion' => \is_numeric($tokens[$i+1] ?? null) ? $tokens[$i+1] : null
326
+					'platformversion' => \is_numeric($tokens[$i + 1] ?? null) ? $tokens[$i + 1] : null
327 327
 				];
328 328
 			}),
329
-			'ThinkPad' => new props('start', function (string $value, int $i, array $tokens) : array {
329
+			'ThinkPad' => new props('start', function(string $value, int $i, array $tokens) : array {
330 330
 				if (\mb_strpos($tokens[++$i] ?? '', 'Build/') === 0) {
331 331
 					$device = \explode('_', \mb_substr($tokens[$i], 6));
332 332
 				}
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
 					'build' => $device[2] ?? null
339 339
 				];
340 340
 			}),
341
-			'BlackBerry' => new props('start', function (string $value) : array {
341
+			'BlackBerry' => new props('start', function(string $value) : array {
342 342
 				$parts = \explode('/', $value);
343 343
 				return [
344 344
 					'type' => 'human',
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
 				'model' => \mb_substr($value, 6)
354 354
 			]),
355 355
 			'Build/' => new props('any', fn (string $value) : array => self::getDevice($value)),
356
-			'x' => new props('any', function (string $value) : ?array {
356
+			'x' => new props('any', function(string $value) : ?array {
357 357
 				if (\str_contains($value, '@')) {
358 358
 					$dpi = \explode('@', $value);
359 359
 					$value = $dpi[0];
Please login to merge, or discard this patch.
src/mappings/platforms.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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 [];
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 				'platformversion' => \mb_substr($value, 6),
161 161
 				'bits' => 64
162 162
 			]),
163
-			'Mac OS X' => new props('any', function (string $value) : array {
163
+			'Mac OS X' => new props('any', function(string $value) : array {
164 164
 				$version = \str_replace('_', '.', \mb_substr($value, \mb_stripos($value, 'Mac OS X') + 9));
165 165
 				$register = $version && \intval(\explode('.', $version)[1] ?? 0) >= 6 ? 64 : null;
166 166
 				return [
@@ -195,9 +195,9 @@  discard block
 block discarded – undo
195 195
 				'type' => 'human',
196 196
 				'category' => 'mobile',
197 197
 				'platform' => 'iOS',
198
-				'platformversion' => $tokens[$i+1]
198
+				'platformversion' => $tokens[$i + 1]
199 199
 			]),
200
-			'CrOS' => new props('start', function (string $value) : array {
200
+			'CrOS' => new props('start', function(string $value) : array {
201 201
 				$parts = \explode(' ', $value);
202 202
 				return [
203 203
 					'type' => 'human',
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 				'platform' => 'Kindle',
213 213
 				'platformversion' => \mb_substr($value, 7)
214 214
 			]),
215
-			'Tizen' => new props('start', function (string $value) : array {
215
+			'Tizen' => new props('start', function(string $value) : array {
216 216
 				$parts = \explode(' ', $value, 2);
217 217
 				return [
218 218
 					'type' => 'human',
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 					'platformversion' => $parts[1] ?? null
223 223
 				];
224 224
 			}),
225
-			'KAIOS/' => new props('start', function (string $value, int $i, array $tokens) : array {
225
+			'KAIOS/' => new props('start', function(string $value, int $i, array $tokens) : array {
226 226
 
227 227
 				// find device
228 228
 				foreach ($tokens AS $i => $item) {
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
 				'kernel' => 'unix',
296 296
 				'platform' => 'Solaris',
297 297
 			]),
298
-			'AmigaOS' => new props('any', function (string $value) : array {
298
+			'AmigaOS' => new props('any', function(string $value) : array {
299 299
 				if (($pos = \mb_stripos($value, 'AmigaOS')) !== false) {
300 300
 					$value = \mb_substr($value, $pos);
301 301
 				}
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
 					'platformversion' => isset($parts[1]) && \strspn($parts[1], '0123456789.-_') === \strlen($parts[1]) ? $parts[1] : null
309 309
 				];
310 310
 			}),
311
-			'Fuchsia' => new props('exact', function (string $value, int $i, array $tokens) : array {
311
+			'Fuchsia' => new props('exact', function(string $value, int $i, array $tokens) : array {
312 312
 				$os = \explode(' ', $tokens[++$i], 2);
313 313
 				return [
314 314
 					'type' => 'human',
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
 					'platformversion' => isset($os[1]) && \strspn($os[1], '0123456789.-_', \strlen($os[0])) === \strlen($os[1]) ? $os[1] : null
319 319
 				];
320 320
 			}),
321
-			'Maemo' => new props('exact', function (string $value, int $i, array $tokens) : array {
321
+			'Maemo' => new props('exact', function(string $value, int $i, array $tokens) : array {
322 322
 				$os = \explode(' ', $tokens[++$i], 2);
323 323
 				return [
324 324
 					'type' => 'human',
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
 				'kernel' => 'Java VM',
335 335
 				'platform' => $value
336 336
 			]),
337
-			'Haiku' => new props('any', function (string $value) : array {
337
+			'Haiku' => new props('any', function(string $value) : array {
338 338
 				$parts = \explode('/', $value, 2);
339 339
 				return [
340 340
 					'type' => 'human',
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
 					'platformversion' => $parts[1] ?? null
345 345
 				];
346 346
 			}),
347
-			'BeOS' => new props('start', function (string $value) : array {
347
+			'BeOS' => new props('start', function(string $value) : array {
348 348
 				$parts = \explode('/', $value, 2);
349 349
 				return [
350 350
 					'type' => 'human',
@@ -361,14 +361,14 @@  discard block
 block discarded – undo
361 361
 				'platformversion' => \explode('/', $value, 3)[1] ?: null
362 362
 			]),
363 363
 			'Android ' => new props('start', $fn['android']),
364
-			'Linux' => new props('any', function (string $value, int $i, array $tokens) : array {
364
+			'Linux' => new props('any', function(string $value, int $i, array $tokens) : array {
365 365
 				return [
366 366
 					'kernel' => 'Linux',
367 367
 					'platform' => 'Linux',
368 368
 					'platformversion' => \str_contains($tokens[$i + 1] ?? '', '.') && \strspn($tokens[$i + 1], '0123456789.') >= 3 ? \explode(' ', $tokens[$i + 1])[0] : null
369 369
 				];
370 370
 			}),
371
-			'X11' => new props('exact', function (string $value, int $i, array $tokens) : array {
371
+			'X11' => new props('exact', function(string $value, int $i, array $tokens) : array {
372 372
 				$os = \explode(' ', $tokens[++$i] ?? '', 2);
373 373
 				return [
374 374
 					'category' => 'desktop',
Please login to merge, or discard this patch.
src/mappings/apps.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
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
 block discarded – undo
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]) && !\is_numeric($parts[1]) ? 1 : 0;
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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',
@@ -114,16 +114,16 @@  discard block
 block discarded – undo
114 114
 				'appname' => 'Zoom',
115 115
 				'appversion' => \mb_substr($value, 5)
116 116
 			]),
117
-			'Reddit/' => new props('start', function (string $value, int $i, array $tokens) : array {
118
-				$os = !empty($tokens[$i+2]) ? \explode('/', $tokens[$i+2], 2) : null;
117
+			'Reddit/' => new props('start', function(string $value, int $i, array $tokens) : array {
118
+				$os = !empty($tokens[$i + 2]) ? \explode('/', $tokens[$i + 2], 2) : null;
119 119
 				$parts = !empty($os[1]) ? \explode(' ', $os[1], 3) : null;
120 120
 				return [
121 121
 					'type' => 'human',
122 122
 					'app' => 'Reddit',
123 123
 					'appname' => 'Reddit',
124
-					'appversion' => $value === 'Reddit/Version' ? (\mb_strstr($tokens[$i+1], '/', true) ?: null) : \mb_substr($value, 7),
124
+					'appversion' => $value === 'Reddit/Version' ? (\mb_strstr($tokens[$i + 1], '/', true) ?: null) : \mb_substr($value, 7),
125 125
 					'platform' => $parts[0] ?? null,
126
-					'platformversion' => $tokens[$i+3] ?? null
126
+					'platformversion' => $tokens[$i + 3] ?? null
127 127
 				];
128 128
 			}),
129 129
 			'Pinterest for ' => new props('start', fn (string $value) : array => [
@@ -187,9 +187,9 @@  discard block
 block discarded – undo
187 187
 			'Instapaper' => new props('start', fn (string $value, int $i, array $tokens, string $match) => \array_merge([
188 188
 				'type' => 'human'
189 189
 			], $fn['appslash']($value, $i, $tokens, $match))),
190
-			'Player/LG' => new props('start', function (string $value, int $i, array $tokens) : ?array {
191
-				if (\str_starts_with($tokens[$i+1], 'Player ')) {
192
-					$parts = \explode(' ', $tokens[$i+1]);
190
+			'Player/LG' => new props('start', function(string $value, int $i, array $tokens) : ?array {
191
+				if (\str_starts_with($tokens[$i + 1], 'Player ')) {
192
+					$parts = \explode(' ', $tokens[$i + 1]);
193 193
 					$device = $i === 1 ? \explode('/', $tokens[0]) : null;
194 194
 					return [
195 195
 						'type' => 'human',
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 				'app' => 'WeChat',
219 219
 				'appname' => 'MicroMessenger'
220 220
 			]),
221
-			'weibo' => new props('any', function (string $value) : array {
221
+			'weibo' => new props('any', function(string $value) : array {
222 222
 				$data = [
223 223
 					'app' => 'Weibo',
224 224
 					'appname' => 'Weibo'
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 			}),
236 236
 
237 237
 			// special parser for Facebook app because it is completely different to any other
238
-			'FBAN/' => new props('any', function (string $value) : array {
238
+			'FBAN/' => new props('any', function(string $value) : array {
239 239
 				$map = [
240 240
 					'FBAN/MessengerLiteForiOS' => [
241 241
 						'type' => 'human',
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
 			'FBMD/' => new props('start', fn (string $value) : array => [
291 291
 				'model' => \mb_substr($value, 5)
292 292
 			]),
293
-			'FBDM/' => new props('start', function (string $value) : array {
293
+			'FBDM/' => new props('start', function(string $value) : array {
294 294
 				$data = [];
295 295
 				foreach (\explode(',', \trim(\mb_substr($value, 5), '{}')) AS $item) {
296 296
 					$parts = \explode('=', $item);
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
 			'FBSV' => new props('start', fn (string $value) : array => [
319 319
 				'platformversion' => \mb_substr($value, 5)
320 320
 			]),
321
-			'isDarkMode/' => new props('start', function (string $value) : array {
321
+			'isDarkMode/' => new props('start', function(string $value) : array {
322 322
 				$mode = \mb_substr($value, 11);
323 323
 				return [
324 324
 					'darkmode' => \in_array($mode, ['0', '1'], true) ? \boolval($mode) : null
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
 			'NetType/' => new props('start', fn (string $value) : array => [
331 331
 				'nettype' => \mb_convert_case(\mb_substr($value, 8), MB_CASE_UPPER)
332 332
 			]),
333
-			'Microsoft Office' => new props('start', function (string $value, int $i, array $tokens) : array {
333
+			'Microsoft Office' => new props('start', function(string $value, int $i, array $tokens) : array {
334 334
 				$data = [
335 335
 					'type' => 'human'
336 336
 				];
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
 			}),
365 365
 
366 366
 			// TikTok
367
-			'AppName/' => new props('start', function (string $value) : array {
367
+			'AppName/' => new props('start', function(string $value) : array {
368 368
 				$map = [
369 369
 					'AppName/musical_ly' => 'TikTok',
370 370
 					'AppName/aweme' => 'Douyin'
Please login to merge, or discard this patch.
src/helpers/versions.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@
 block discarded – undo
1 1
 <?php
2
-declare(strict_types = 1);
2
+declare(strict_types=1);
3 3
 namespace hexydec\agentzero;
4 4
 
5 5
 class versions {
6 6
 
7
-	protected static ?array $versions = null;
7
+	protected static ? array $versions = null;
8 8
 
9 9
 	protected static function load(string $source, ?string $cache, int $life = 604800) : array|false {
10 10
 
Please login to merge, or discard this patch.
src/mappings/browsers.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types = 1);
2
+declare(strict_types=1);
3 3
 namespace hexydec\agentzero;
4 4
 
5 5
 class browsers {
@@ -66,21 +66,21 @@  discard block
 block discarded – undo
66 66
 	public static function get() : array {
67 67
 		$fn = [
68 68
 			'browserslash' => fn (string $value, int $i, array $tokens, string $key, array $config = []) : array => self::getBrowser($value, $i, $tokens, $key, $config),
69
-			'gecko' => function (string $value, int $i, array $tokens, string $key, array $config = []) : array {
69
+			'gecko' => function(string $value, int $i, array $tokens, string $key, array $config = []) : array {
70 70
 				$parts = \explode('/', $value, 2);
71 71
 				return \array_replace(self::getBrowser($value, $i, $tokens, $key, $config), [
72 72
 					'engine' => 'Gecko',
73 73
 					'engineversion' => $parts[1] ?? null,
74 74
 				]);
75 75
 			},
76
-			'presto' => function (string $value, int $i, array $tokens, string $key, array $config = []) : array {
76
+			'presto' => function(string $value, int $i, array $tokens, string $key, array $config = []) : array {
77 77
 				$parts = \explode('/', $value, 2);
78 78
 				return \array_replace(self::getBrowser($value, $i, $tokens, $key, $config), [
79 79
 					'engine' => 'Presto',
80 80
 					'engineversion' => $parts[1] ?? null,
81 81
 				]);
82 82
 			},
83
-			'chromium' => function (string $value, int $i, array $tokens, string $key, array $config = []) : array {
83
+			'chromium' => function(string $value, int $i, array $tokens, string $key, array $config = []) : array {
84 84
 				$parts = \explode('/', $value, 3);
85 85
 				$engineversion = isset($parts[1]) && \strspn($parts[1], '1234567890.') === \strlen($parts[1]) ? $parts[1] : null;
86 86
 				return \array_replace(self::getBrowser($value, $i, $tokens, $key, $config), [
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 					'engineversion' => $engineversion
89 89
 				]);
90 90
 			},
91
-			'safari' => function (string $value, int $i, array $tokens, string $key, array $config = []) : array {
91
+			'safari' => function(string $value, int $i, array $tokens, string $key, array $config = []) : array {
92 92
 				$parts = \explode('/', $value, 2);
93 93
 				$version = $parts[1] ?? null;
94 94
 				foreach ($tokens AS $item) {
@@ -146,10 +146,10 @@  discard block
 block discarded – undo
146 146
 			'CocCoc/' => new props('start', $fn['browserslash']),
147 147
 			'Obigo/' => new props('start', $fn['browserslash']),
148 148
 			'VivoBrowser/' => new props('start', $fn['browserslash']),
149
-			'QQBrowser/' => new props('any', function (string $value, int $i, array $tokens, string $key, array $config = []) use ($fn) : array {
149
+			'QQBrowser/' => new props('any', function(string $value, int $i, array $tokens, string $key, array $config = []) use ($fn) : array {
150 150
 				return $fn['browserslash'](\mb_substr($value, \mb_stripos($value, 'QQBrowser/') ?: 0), $i, $tokens, $key, $config); // sometimes missing a space from previous declaration, and MQQBrowser for mobile.
151 151
 			}),
152
-			'MiuiBrowser/' => new props('any', function (string $value, int $i, array $tokens, string $key, array $config = []) use ($fn) : array {
152
+			'MiuiBrowser/' => new props('any', function(string $value, int $i, array $tokens, string $key, array $config = []) use ($fn) : array {
153 153
 				return $fn['browserslash'](\mb_substr($value, \mb_stripos($value, 'MiuiBrowser/') ?: 0), $i, $tokens, $key, $config);
154 154
 			}),
155 155
 			'Lynx/' => new props('start', fn (string $value) : array => [
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 				'type' => 'human',
160 160
 				'category' => 'desktop'
161 161
 			]),
162
-			'Midori' => new props('start', function (string $value, int $i, array $tokens, string $key, array $config = []) : array {
162
+			'Midori' => new props('start', function(string $value, int $i, array $tokens, string $key, array $config = []) : array {
163 163
 				$parts = \explode('/', $value, 2);
164 164
 				$version = $parts[1] ?? \explode(' ', $value, 2)[1] ?? null;
165 165
 				$major = $version !== null ? \intval($version) : null;
@@ -179,13 +179,13 @@  discard block
 block discarded – undo
179 179
 				'engine' => 'Gecko',
180 180
 				'browser' => 'Firefox'
181 181
 			]),
182
-			'Minimo/' => new props('start', function (string $value, int $i, array $tokens, string $key, array $config = []) use ($fn) : array {
182
+			'Minimo/' => new props('start', function(string $value, int $i, array $tokens, string $key, array $config = []) use ($fn) : array {
183 183
 				$data = $fn['browserslash']($value, $i, $tokens, $key, $config);
184 184
 				return \array_merge($data, [
185 185
 					'engine' => 'Gecko'
186 186
 				]);
187 187
 			}),
188
-			'BonEcho/' => new props('start', function (string $value, int $i, array $tokens, string $key, array $config = []) use ($fn) : array {
188
+			'BonEcho/' => new props('start', function(string $value, int $i, array $tokens, string $key, array $config = []) use ($fn) : array {
189 189
 				$data = $fn['browserslash']($value, $i, $tokens, $key, $config);
190 190
 				return \array_merge($data, [
191 191
 					'engine' => 'Gecko'
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 				'browserversion' => \mb_substr($value, 9),
232 232
 				'engine' => 'Trident'
233 233
 			], versions::get('ie', \mb_substr($value, 9), $config['versions']))),
234
-			'Trident' => new props('start', [ // infill for missing browser name
234
+			'Trident' => new props('start', [// infill for missing browser name
235 235
 				'browser' => 'Internet Explorer'
236 236
 			]),
237 237
 			'Cronet/' => new props('start', $fn['chromium']),
Please login to merge, or discard this patch.
src/helpers/hints.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types = 1);
2
+declare(strict_types=1);
3 3
 namespace hexydec\agentzero;
4 4
 
5 5
 class hints {
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 		// sort the values in importance order
42 42
 		$sort = ['Chromium', 'Chrome'];
43 43
 		$count = \count($sort);
44
-		\uksort($items, function (string $a, string $b) use ($sort, $count) : int {
44
+		\uksort($items, function(string $a, string $b) use ($sort, $count) : int {
45 45
 			$aval = $bval = $count;
46 46
 			foreach ($sort AS $key => $item) {
47 47
 				if (\mb_stripos($a, $item)) {
Please login to merge, or discard this patch.