Passed
Push — main ( 9d9f86...c7c94b )
by Will
02:57
created
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]) ? 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 => [
@@ -185,9 +185,9 @@  discard block
 block discarded – undo
185 185
 			'Instapaper' => new props('start', fn (string $value, int $i, array $tokens, string $match) => \array_merge([
186 186
 				'type' => 'human'
187 187
 			], $fn['appslash']($value, $i, $tokens, $match))),
188
-			'Player/LG' => new props('start', function (string $value, int $i, array $tokens) : ?array {
189
-				if (\str_starts_with($tokens[$i+1], 'Player ')) {
190
-					$parts = \explode(' ', $tokens[$i+1]);
188
+			'Player/LG' => new props('start', function(string $value, int $i, array $tokens) : ?array {
189
+				if (\str_starts_with($tokens[$i + 1], 'Player ')) {
190
+					$parts = \explode(' ', $tokens[$i + 1]);
191 191
 					$device = $i === 1 ? \explode('/', $tokens[0]) : null;
192 192
 					return [
193 193
 						'type' => 'human',
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 				'app' => 'WeChat',
216 216
 				'appname' => 'MicroMessenger'
217 217
 			]),
218
-			'weibo' => new props('any', function (string $value) : array {
218
+			'weibo' => new props('any', function(string $value) : array {
219 219
 				$data = [
220 220
 					'app' => 'Weibo',
221 221
 					'appname' => 'Weibo'
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 			}),
233 233
 
234 234
 			// special parser for Facebook app because it is completely different to any other
235
-			'FBAN/' => new props('any', function (string $value) : array {
235
+			'FBAN/' => new props('any', function(string $value) : array {
236 236
 				$map = [
237 237
 					'FBAN/MessengerLiteForiOS' => [
238 238
 						'type' => 'human',
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
 			'FBMD/' => new props('start', fn (string $value) : array => [
288 288
 				'model' => \mb_substr($value, 5)
289 289
 			]),
290
-			'FBDM/' => new props('start', function (string $value) : array {
290
+			'FBDM/' => new props('start', function(string $value) : array {
291 291
 				$data = [];
292 292
 				foreach (\explode(',', \trim(\mb_substr($value, 5), '{}')) AS $item) {
293 293
 					$parts = \explode('=', $item);
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
 			'FBSV' => new props('start', fn (string $value) : array => [
316 316
 				'platformversion' => \mb_substr($value, 5)
317 317
 			]),
318
-			'isDarkMode/' => new props('start', function (string $value) : array {
318
+			'isDarkMode/' => new props('start', function(string $value) : array {
319 319
 				$mode = \mb_substr($value, 11);
320 320
 				return [
321 321
 					'darkmode' => \in_array($mode, ['0', '1'], true) ? \boolval($mode) : null
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
 			'NetType/' => new props('start', fn (string $value) : array => [
328 328
 				'nettype' => \mb_convert_case(\mb_substr($value, 8), MB_CASE_UPPER)
329 329
 			]),
330
-			'Microsoft Office' => new props('start', function (string $value, int $i, array $tokens) : array {
330
+			'Microsoft Office' => new props('start', function(string $value, int $i, array $tokens) : array {
331 331
 				$data = [
332 332
 					'type' => 'human'
333 333
 				];
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
 			}),
362 362
 
363 363
 			// TikTok
364
-			'AppName/' => new props('start', function (string $value) : array {
364
+			'AppName/' => new props('start', function(string $value) : array {
365 365
 				$map = [
366 366
 					'AppName/musical_ly' => 'TikTok',
367 367
 					'AppName/aweme' => 'Douyin'
Please login to merge, or discard this patch.