Passed
Push — main ( 1902e7...09cef8 )
by Will
02:55
created
src/mappings/apps.php 1 patch
Spacing   +9 added lines, -9 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
 /**
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 	 */
15 15
 	public static function get() : array {
16 16
 		$fn = [
17
-			'appslash' => function (string $value, int $i, array $tokens, string $match) : ?array {
17
+			'appslash' => function(string $value, int $i, array $tokens, string $match) : ?array {
18 18
 				if (\mb_stripos($value, 'AppleWebKit') !== 0 && !\str_contains($value, '://')) {
19 19
 					$parts = \explode('/', $value, 4);
20 20
 					$offset = isset($parts[2]) ? 1 : 0;
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 				}
42 42
 				return null;
43 43
 			},
44
-			'langslash' => function (string $value) : array {
44
+			'langslash' => function(string $value) : array {
45 45
 				$parts = \explode('-', \str_replace('_', '-', \explode('/', $value, 2)[1]), 4);
46 46
 				$suffix = $parts[2] ?? $parts[1] ?? null;
47 47
 				return [
@@ -52,11 +52,11 @@  discard block
 block discarded – undo
52 52
 		return [
53 53
 			'OcIdWebView' => [
54 54
 				'match' => 'exact',
55
-				'categories' => function (string $value, int $i, array $tokens) : array {
55
+				'categories' => function(string $value, int $i, array $tokens) : array {
56 56
 					$data = [
57 57
 						'app' => $value
58 58
 					];
59
-					if (!empty($tokens[$i+1]) && ($json = \json_decode($tokens[$i+1], true)) !== null) {
59
+					if (!empty($tokens[$i + 1]) && ($json = \json_decode($tokens[$i + 1], true)) !== null) {
60 60
 						$data['appversion'] = $json['appVersion'] ?? null;
61 61
 						$data['darkmode'] = isset($json['isDarkTheme']) ? \boolval($json['isDarkTheme']) : null;
62 62
 					}
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 			],
70 70
 			'Instagram' => [
71 71
 				'match' => 'any',
72
-				'categories' => function (string $value, int $i, array $tokens) : array {
72
+				'categories' => function(string $value, int $i, array $tokens) : array {
73 73
 					$data = [
74 74
 						'app' => 'Instagram',
75 75
 						'appversion' => \explode(' ', $value, 3)[1] ?? null
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 			// special parser for Facebook app because it is completely different to any other
124 124
 			'FBAN/' => [
125 125
 				'match' => 'any',
126
-				'categories' => function (string $value) : array {
126
+				'categories' => function(string $value) : array {
127 127
 					$map = [
128 128
 						'FBAN/MessengerLiteForiOS' => [
129 129
 							'type' => 'human',
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 			],
201 201
 			'FBDM/' => [
202 202
 				'match' => 'start',
203
-				'categories' => function (string $value) : array {
203
+				'categories' => function(string $value) : array {
204 204
 					$data = [];
205 205
 					foreach (\explode(',', \trim(\mb_substr($value, 5), '{}')) AS $item) {
206 206
 						$parts = \explode('=', $item);
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 			],
247 247
 			'isDarkMode/' => [
248 248
 				'match' => 'start',
249
-				'categories' => function (string $value) : array {
249
+				'categories' => function(string $value) : array {
250 250
 					$mode = \mb_substr($value, 11);
251 251
 					return [
252 252
 						'darkmode' => \in_array($mode, ['0', '1'], true) ? \boolval($mode) : null
Please login to merge, or discard this patch.
src/mappings/platforms.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
 /**
@@ -14,14 +14,14 @@  discard block
 block discarded – undo
14 14
 	 */
15 15
 	public static function get() : array {
16 16
 		$fn = [
17
-			'platformspace' => function (string $value) : array {
17
+			'platformspace' => function(string $value) : array {
18 18
 				$parts = \explode(' ', $value, 2);
19 19
 				return [
20 20
 					'platform' => $parts[0],
21 21
 					'platformversion' => $parts[1] ?? null
22 22
 				];
23 23
 			},
24
-			'platformlinux' => function (string $value) : array {
24
+			'platformlinux' => function(string $value) : array {
25 25
 				if (!\str_starts_with($value, 'Red Hat/') && ($platform = \mb_strstr($value, ' ', true)) !== false) {
26 26
 					$value = $platform;
27 27
 				}
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 					'platformversion' => $parts[1] ?? null
41 41
 				];
42 42
 			},
43
-			'platformwindows' => function (string $value) : array {
43
+			'platformwindows' => function(string $value) : array {
44 44
 				$mapping = [
45 45
 					'5.0' => '2000',
46 46
 					'5.1' => 'XP',
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 					'platformversion' => $mapping[$version] ?? $version
67 67
 				];
68 68
 			},
69
-			'android' => function (string $value, int $i, array $tokens) : array {
69
+			'android' => function(string $value, int $i, array $tokens) : array {
70 70
 				$os = \explode(' ', $value, 3);
71 71
 
72 72
 				// skip language
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 			],
92 92
 			'Windows Phone' => [
93 93
 				'match' => 'start',
94
-				'categories' => function (string $value) : array {
94
+				'categories' => function(string $value) : array {
95 95
 					$version = \mb_substr($value, 14);
96 96
 					return [
97 97
 						'type' => 'human',
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 			],
133 133
 			'Mac OS X' => [
134 134
 				'match' => 'any',
135
-				'categories' => function (string $value) : array {
135
+				'categories' => function(string $value) : array {
136 136
 					$version = \str_replace('_', '.', \mb_substr($value, \mb_stripos($value, 'Mac OS X') + 9));
137 137
 					$register = $version && \intval(\explode('.', $version)[1] ?? 0) >= 6 ? 64 : null;
138 138
 					return [
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 			],
167 167
 			'CrOS' => [
168 168
 				'match' => 'start',
169
-				'categories' => function (string $value) : array {
169
+				'categories' => function(string $value) : array {
170 170
 					$parts = \explode(' ', $value);
171 171
 					return [
172 172
 						'type' => 'human',
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 			],
188 188
 			'Tizen' => [
189 189
 				'match' => 'start',
190
-				'categories' => function (string $value) : array {
190
+				'categories' => function(string $value) : array {
191 191
 					$parts = \explode(' ', $value, 2);
192 192
 					return [
193 193
 						'type' => 'human',
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
 			],
291 291
 			'AmigaOS' => [
292 292
 				'match' => 'any',
293
-				'categories' => function (string $value) : array {
293
+				'categories' => function(string $value) : array {
294 294
 					if (($pos = \mb_stripos($value, 'AmigaOS')) !== false) {
295 295
 						$value = \mb_substr($value, $pos);
296 296
 					}
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
 			],
307 307
 			'Fuchsia' => [
308 308
 				'match' => 'exact',
309
-				'categories' => function (string $value, int $i, array $tokens) : array {
309
+				'categories' => function(string $value, int $i, array $tokens) : array {
310 310
 					$os = \explode(' ', $tokens[++$i], 2);
311 311
 					return [
312 312
 						'type' => 'human',
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
 			],
320 320
 			'Maemo' => [
321 321
 				'match' => 'exact',
322
-				'categories' => function (string $value, int $i, array $tokens) : array {
322
+				'categories' => function(string $value, int $i, array $tokens) : array {
323 323
 					$os = \explode(' ', $tokens[++$i], 2);
324 324
 					return [
325 325
 						'type' => 'human',
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
 			],
342 342
 			'Haiku' => [
343 343
 				'match' => 'any',
344
-				'categories' => function (string $value) : array {
344
+				'categories' => function(string $value) : array {
345 345
 					$parts = \explode('/', $value, 2);
346 346
 					return [
347 347
 						'type' => 'human',
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
 			],
355 355
 			'BeOS' => [
356 356
 				'match' => 'start',
357
-				'categories' => function (string $value) : array {
357
+				'categories' => function(string $value) : array {
358 358
 					$parts = \explode('/', $value, 2);
359 359
 					return [
360 360
 						'type' => 'human',
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
 			],
383 383
 			'X11' => [
384 384
 				'match' => 'exact',
385
-				'categories' => function (string $value, int $i, array $tokens) : array {
385
+				'categories' => function(string $value, int $i, array $tokens) : array {
386 386
 					$os = \explode(' ', $tokens[++$i] ?? '', 2);
387 387
 					return [
388 388
 						'category' => 'desktop',
Please login to merge, or discard this patch.
src/mappings/browsers.php 1 patch
Spacing   +6 added lines, -6 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
 /**
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 	 */
15 15
 	public static function get() : array {
16 16
 		$fn = [
17
-			'browserslash' => function (string $value) : array {
17
+			'browserslash' => function(string $value) : array {
18 18
 				if (($browser = \mb_strrchr($value, ' ')) !== false) {
19 19
 					$value = \ltrim($browser);
20 20
 				}
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 				}
51 51
 				return $data;
52 52
 			},
53
-			'presto' => function (string $value) : array {
53
+			'presto' => function(string $value) : array {
54 54
 				$parts = \explode('/', $value, 2);
55 55
 				return [
56 56
 					'type' => 'human',
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 					'engineversion' => $parts[1] ?? null
61 61
 				];
62 62
 			},
63
-			'chromium' => function (string $value) : array {
63
+			'chromium' => function(string $value) : array {
64 64
 				$parts = \explode('/', $value, 3);
65 65
 				return [
66 66
 					'type' => 'human',
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 			],
233 233
 			'Midori' => [
234 234
 				'match' => 'start',
235
-				'categories' => function (string $value) : array {
235
+				'categories' => function(string $value) : array {
236 236
 					$parts = \explode('/', $value, 2);
237 237
 					return [
238 238
 						'type' => 'human',
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
 			],
258 258
 			'Firefox/' =>  [
259 259
 				'match' => 'start',
260
-				'categories' => function (string $value) use ($fn) : array {
260
+				'categories' => function(string $value) use ($fn) : array {
261 261
 					$data = $fn['browserslash']($value);
262 262
 					return \array_merge($data, [
263 263
 						'engine' => 'Gecko',
Please login to merge, or discard this patch.