Passed
Push — main ( 151935...797f0d )
by Will
13:06
created
src/mappings/architectures.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 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 architectures {
Please login to merge, or discard this patch.
src/mappings/engines.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 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 engines {
Please login to merge, or discard this patch.
src/mappings/categories.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 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 categories {
Please login to merge, or discard this patch.
src/agentzero.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 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 agentzero {
Please login to merge, or discard this patch.
src/mappings/apps.php 1 patch
Spacing   +10 added lines, -10 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') !== 0 && !\str_contains($value, '://')) {
16 16
 					$parts = \explode('/', $value, 4);
17 17
 					$offset = isset($parts[2]) ? 1 : 0;
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 				}
46 46
 				return [];
47 47
 			},
48
-			'langslash' => function (string $value) : array {
48
+			'langslash' => function(string $value) : array {
49 49
 				$parts = \explode('-', \str_replace('_', '-', \explode('/', $value, 2)[1]), 4);
50 50
 				$suffix = $parts[2] ?? $parts[1] ?? null;
51 51
 				return [
@@ -54,20 +54,20 @@  discard block
 block discarded – undo
54 54
 			}
55 55
 		];
56 56
 		return [
57
-			'com.google.GoogleMobile/' => new props('start', function (string $value, int $i, array $tokens, string $match) use ($fn) : array {
57
+			'com.google.GoogleMobile/' => new props('start', function(string $value, int $i, array $tokens, string $match) use ($fn) : array {
58 58
 				return \array_merge($fn['appslash']($value, $i, $tokens, $match), [
59 59
 					'category' => 'mobile'
60 60
 				]);
61 61
 			}),
62 62
 			'com.google.' => new props('start', $fn['appslash']),
63
-			'OcIdWebView' => new props('exact', function (string $value) : array {
63
+			'OcIdWebView' => new props('exact', function(string $value) : array {
64 64
 				$data = [
65 65
 					'app' => 'Google App Web View',
66 66
 					'appname' => $value
67 67
 				];
68 68
 				return $data;
69 69
 			}),
70
-			'Instagram' => new props('any', function (string $value, int $i, array $tokens) : array {
70
+			'Instagram' => new props('any', function(string $value, int $i, array $tokens) : array {
71 71
 				$parts = \explode(' ', $value, 4);
72 72
 				$data = [
73 73
 					'type' => 'human',
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 			'Viber/' => new props('start', $fn['appslash']),
161 161
 
162 162
 			// special parser for Facebook app because it is completely different to any other
163
-			'FBAN/' => new props('any', function (string $value) : array {
163
+			'FBAN/' => new props('any', function(string $value) : array {
164 164
 				$map = [
165 165
 					'FBAN/MessengerLiteForiOS' => [
166 166
 						'type' => 'human',
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 				'model' => \mb_substr($value, 5)
217 217
 			]),
218 218
 			'FBLC/' => new props('start', $fn['langslash']),
219
-			'FBDM/' => new props('start', function (string $value) : array {
219
+			'FBDM/' => new props('start', function(string $value) : array {
220 220
 				$data = [];
221 221
 				foreach (\explode(',', \trim(\mb_substr($value, 5), '{}')) AS $item) {
222 222
 					$parts = \explode('=', $item);
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
 			'FBSV' => new props('start', fn (string $value) : array => [
245 245
 				'platformversion' => \mb_substr($value, 5)
246 246
 			]),
247
-			'isDarkMode/' => new props('start', function (string $value) : array {
247
+			'isDarkMode/' => new props('start', function(string $value) : array {
248 248
 				$mode = \mb_substr($value, 11);
249 249
 				return [
250 250
 					'darkmode' => \in_array($mode, ['0', '1'], true) ? \boolval($mode) : null
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
 			'NetType/' => new props('start', fn (string $value) : array => [
255 255
 				'nettype' => \mb_convert_case(\mb_substr($value, 8), MB_CASE_UPPER)
256 256
 			]),
257
-			'Microsoft Office' => new props('start', function (string $value, int $i, array $tokens) : array {
257
+			'Microsoft Office' => new props('start', function(string $value, int $i, array $tokens) : array {
258 258
 				$data = [
259 259
 					'type' => 'human'
260 260
 				];
Please login to merge, or discard this patch.
src/mappings/crawlers.php 1 patch
Spacing   +4 added lines, -4 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 {
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 					'category' => 'feed'
49 49
 				]
50 50
 			)),
51
-			'crawler' => function (string $value) : array {
51
+			'crawler' => function(string $value) : array {
52 52
 				$parts = \explode('/', $value, 2);
53 53
 				$map = [
54 54
 					'baiduspider' => 'search',
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 			},
65 65
 			'monitor' => fn (string $value) : array => self::getApp($value, ['category' => 'monitor']),
66 66
 			'scraper' => fn (string $value) : array => self::getApp($value, ['category' => 'scraper']),
67
-			'map' => function (string $value) : ?array {
67
+			'map' => function(string $value) : ?array {
68 68
 				if (!\str_contains($value, '://') && \strcasecmp('Cubot', $value) !== 0 && \strcasecmp('Power bot', $value) !== 0) { // bot will be in the URL
69 69
 					$parts = \explode('/', $value, 2);
70 70
 					$category = [
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
 			'Uptime/' => new props('start', $fn['monitor']),
283 283
 			'HostTracker/' => new props('start', $fn['monitor']),
284 284
 			'NCSC Web Check [email protected]' => new props('exact', $fn['map']),
285
-			'Pingdom.com' => new props('start', function (string $value) : array {
285
+			'Pingdom.com' => new props('start', function(string $value) : array {
286 286
 				$version = \explode('_', \trim($value, '_'));
287 287
 				return [
288 288
 					'type' => 'robot',
Please login to merge, or discard this patch.
src/mappings/other.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 other {
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 	 */
12 12
 	public static function get() : array {
13 13
 		return [
14
-			'{' => new props('any', function (string $value) : ?array {
14
+			'{' => new props('any', function(string $value) : ?array {
15 15
 				if (($start = \mb_strpos($value, '{')) === false) {
16 16
 
17 17
 				} elseif (($end = \mb_strpos($value, '}', $start)) !== false) {
Please login to merge, or discard this patch.
src/mappings/devices.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 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
 				foreach ($tokens AS $item) {
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 				'device' => 'Xbox',
44 44
 				'model' => ($model = \mb_substr($value, 5)) === '' ? null : $model
45 45
 			],
46
-			'playstation' => function (string $value) : array {
46
+			'playstation' => function(string $value) : array {
47 47
 				$parts = \explode(' ', $value);
48 48
 				if (\str_contains($parts[1], '/')) {
49 49
 					list($parts[1], $parts[2]) = \explode('/', $parts[1]);
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 					'bits' => 64
67 67
 				];
68 68
 			},
69
-			'firetablet' => function (string $value) : ?array {
69
+			'firetablet' => function(string $value) : ?array {
70 70
 				$model = \explode(' ', $value)[0];
71 71
 				if (\ctype_alpha($model) && \mb_strlen($model) <= 7) {
72 72
 					return [
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 				'vendor' => 'Google',
146 146
 				'platformversion' => \mb_substr($value, 7)
147 147
 			]),
148
-			'Apple/' => new props('start', function (string $value) : array {
148
+			'Apple/' => new props('start', function(string $value) : array {
149 149
 				$value = \mb_substr($value, 6);
150 150
 				$split = \strcspn($value, '0123456789');
151 151
 				$device = \mb_substr($value, 0, $split);
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 			'googleweblight' => new props('exact', [
198 198
 				'proxy' => 'googleweblight'
199 199
 			]),
200
-			'SAMSUNG-' => new props('start', function (string $value) : array {
200
+			'SAMSUNG-' => new props('start', function(string $value) : array {
201 201
 				$parts = \explode('/', $value, 2);
202 202
 				return [
203 203
 					'type' => 'human',
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 			'Samsung' => new props('start', fn (string $value) : ?array => \str_starts_with($value, 'SamsungBrowser') ? null : [
211 211
 				'vendor' => 'Samsung'
212 212
 			]),
213
-			'SM-' => new props('start', function (string $value) : array {
213
+			'SM-' => new props('start', function(string $value) : array {
214 214
 				$parts = \explode('.', \explode(' ', $value)[0]);
215 215
 				return [
216 216
 					'vendor' => 'Samsung',
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 			'Acer' => new props('start', [
222 222
 				'vendor' => 'Acer'
223 223
 			]),
224
-			'SonyEricsson' => new props('start', function (string $value) : array {
224
+			'SonyEricsson' => new props('start', function(string $value) : array {
225 225
 				$parts = \explode('/', $value, 2);
226 226
 				return [
227 227
 					'type' => 'human',
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 					'build' => $parts[1] ?? null
232 232
 				];
233 233
 			}),
234
-			'LGE' => new props('exact', function (string $value, int $i, array $tokens) : array {
234
+			'LGE' => new props('exact', function(string $value, int $i, array $tokens) : array {
235 235
 				$device = $tokens[++$i] ?? null;
236 236
 				$platformversion = empty($tokens[++$i]) ? null : \mb_substr(\explode(' ', $tokens[$i])[0], 5);
237 237
 				$build = $tokens[++$i] ?? null;
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
 					'vendor' => 'LG'
245 245
 				];
246 246
 			}),
247
-			'NOKIA' => new props('start', function (string $value) : array {
247
+			'NOKIA' => new props('start', function(string $value) : array {
248 248
 				return \array_merge(devices::getDevice($value), [
249 249
 					'type' => 'human',
250 250
 					'category' => 'mobile',
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
 				'vendor' => 'Tecno',
269 269
 				'model' => \explode(' ', \str_replace('-', ' ', $value), 2)[1] ?? null
270 270
 			]),
271
-			'ThinkPad' => new props('start', function (string $value, int $i, array $tokens) : array {
271
+			'ThinkPad' => new props('start', function(string $value, int $i, array $tokens) : array {
272 272
 				if (\mb_strpos($tokens[++$i] ?? '', 'Build/') === 0) {
273 273
 					$device = \explode('_', \mb_substr($tokens[$i], 6));
274 274
 				}
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
 					'build' => $device[2] ?? null
281 281
 				];
282 282
 			}),
283
-			'BlackBerry' => new props('start', function (string $value) : array {
283
+			'BlackBerry' => new props('start', function(string $value) : array {
284 284
 				$parts = \explode('/', $value);
285 285
 				return [
286 286
 					'type' => 'human',
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
 				'model' => \mb_substr($value, 6)
296 296
 			]),
297 297
 			'Build/' => new props('any', fn (string $value) : array => self::getDevice($value)),
298
-			'x' => new props('any', function (string $value) : ?array {
298
+			'x' => new props('any', function(string $value) : ?array {
299 299
 				$parts = \explode('x', $value);
300 300
 				if (!isset($parts[2]) && \is_numeric($parts[0]) && \is_numeric($parts[1])) {
301 301
 					return [
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
 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
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 
79 79
 			// platforms
80 80
 			'Windows NT ' => new props('any', $fn['platformwindows']),
81
-			'Windows Phone' => new props('start', function (string $value) : array {
81
+			'Windows Phone' => new props('start', function(string $value) : array {
82 82
 				$version = \mb_substr($value, 14);
83 83
 				return [
84 84
 					'type' => 'human',
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 				'platformversion' => \mb_substr($value, 5)
121 121
 			]),
122 122
 			'Windows' => new props('any', $fn['platformwindows']),
123
-			'Mac OS X' => new props('any', function (string $value) : array {
123
+			'Mac OS X' => new props('any', function(string $value) : array {
124 124
 				$version = \str_replace('_', '.', \mb_substr($value, \mb_stripos($value, 'Mac OS X') + 9));
125 125
 				$register = $version && \intval(\explode('.', $version)[1] ?? 0) >= 6 ? 64 : null;
126 126
 				return [
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 				'platform' => 'iOS',
146 146
 				'platformversion' => \mb_substr($value, 4)
147 147
 			]),
148
-			'CrOS' => new props('start', function (string $value) : array {
148
+			'CrOS' => new props('start', function(string $value) : array {
149 149
 				$parts = \explode(' ', $value);
150 150
 				return [
151 151
 					'type' => 'human',
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 				'platform' => 'Kindle',
161 161
 				'platformversion' => \mb_substr($value, 7)
162 162
 			]),
163
-			'Tizen' => new props('start', function (string $value) : array {
163
+			'Tizen' => new props('start', function(string $value) : array {
164 164
 				$parts = \explode(' ', $value, 2);
165 165
 				return [
166 166
 					'type' => 'human',
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 				'kernel' => 'unix',
216 216
 				'platform' => 'Solaris',
217 217
 			]),
218
-			'AmigaOS' => new props('any', function (string $value) : array {
218
+			'AmigaOS' => new props('any', function(string $value) : array {
219 219
 				if (($pos = \mb_stripos($value, 'AmigaOS')) !== false) {
220 220
 					$value = \mb_substr($value, $pos);
221 221
 				}
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 					'platformversion' => isset($parts[1]) && \strspn($parts[1], '0123456789.-_') === \strlen($parts[1]) ? $parts[1] : null
229 229
 				];
230 230
 			}),
231
-			'Fuchsia' => new props('exact', function (string $value, int $i, array $tokens) : array {
231
+			'Fuchsia' => new props('exact', function(string $value, int $i, array $tokens) : array {
232 232
 				$os = \explode(' ', $tokens[++$i], 2);
233 233
 				return [
234 234
 					'type' => 'human',
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 					'platformversion' => isset($os[1]) && \strspn($os[1], '0123456789.-_', \strlen($os[0])) === \strlen($os[1]) ? $os[1] : null
239 239
 				];
240 240
 			}),
241
-			'Maemo' => new props('exact', function (string $value, int $i, array $tokens) : array {
241
+			'Maemo' => new props('exact', function(string $value, int $i, array $tokens) : array {
242 242
 				$os = \explode(' ', $tokens[++$i], 2);
243 243
 				return [
244 244
 					'type' => 'human',
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
 				'kernel' => 'Java VM',
255 255
 				'platform' => $value
256 256
 			]),
257
-			'Haiku' => new props('any', function (string $value) : array {
257
+			'Haiku' => new props('any', function(string $value) : array {
258 258
 				$parts = \explode('/', $value, 2);
259 259
 				return [
260 260
 					'type' => 'human',
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 					'platformversion' => $parts[1] ?? null
265 265
 				];
266 266
 			}),
267
-			'BeOS' => new props('start', function (string $value) : array {
267
+			'BeOS' => new props('start', function(string $value) : array {
268 268
 				$parts = \explode('/', $value, 2);
269 269
 				return [
270 270
 					'type' => 'human',
@@ -276,14 +276,14 @@  discard block
 block discarded – undo
276 276
 			}),
277 277
 			'Android' => new props('exact', $fn['android']),
278 278
 			'Android ' => new props('start', $fn['android']),
279
-			'Linux' => new props('any', function (string $value, int $i, array $tokens) : array {
279
+			'Linux' => new props('any', function(string $value, int $i, array $tokens) : array {
280 280
 				return [
281 281
 					'kernel' => 'Linux',
282 282
 					'platform' => 'Linux',
283 283
 					'platformversion' => \str_contains($tokens[$i + 1] ?? '', '.') && \strspn($tokens[$i + 1], '0123456789.') >= 3 ? \explode(' ', $tokens[$i + 1])[0] : null
284 284
 				];
285 285
 			}),
286
-			'X11' => new props('exact', function (string $value, int $i, array $tokens) : array {
286
+			'X11' => new props('exact', function(string $value, int $i, array $tokens) : array {
287 287
 				$os = \explode(' ', $tokens[++$i] ?? '', 2);
288 288
 				return [
289 289
 					'category' => 'desktop',
Please login to merge, or discard this patch.