Passed
Push — main ( dc2e53...6bdb06 )
by Will
02:48
created
src/mappings/frameworks.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 frameworks {
Please login to merge, or discard this patch.
src/mappings/languages.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 languages {
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 			'zu' => 'Zulu',
134 134
 			'in' => 'India'
135 135
 		];
136
-		$fn = function (string $value, int $i, array $tokens, string $match) : ?array {
136
+		$fn = function(string $value, int $i, array $tokens, string $match) : ?array {
137 137
 			if ($value === $match) {
138 138
 				return ['language' => $value];
139 139
 			} else {
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 			}
147 147
 			return null;
148 148
 		};
149
-		$lang = function (string $value) use ($languages): ?array {
149
+		$lang = function(string $value) use ($languages): ?array {
150 150
 			$value = \str_replace('_', '-', \explode('/', $value)[1]);
151 151
 			$lang = \mb_strtolower(\mb_substr($value, 0, 2));
152 152
 			$len = \mb_strlen($value);
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 {
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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']),
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
 
@@ -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 [
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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 [
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;
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 			},
30 30
 		];
31 31
 		return [
32
-			'com.google.' => new props('start', function (string $value) : array {
32
+			'com.google.' => new props('start', function(string $value) : array {
33 33
 				$parts = \explode('/', $value, 3);
34 34
 				return [
35 35
 					'type' => 'human',
@@ -38,14 +38,14 @@  discard block
 block discarded – undo
38 38
 					'appversion' => $parts[1] ?? null
39 39
 				];
40 40
 			}),
41
-			'OcIdWebView' => new props('exact', function (string $value) : array {
41
+			'OcIdWebView' => new props('exact', function(string $value) : array {
42 42
 				$data = [
43 43
 					'app' => 'Google App Web View',
44 44
 					'appname' => $value
45 45
 				];
46 46
 				return $data;
47 47
 			}),
48
-			'Instagram' => new props('any', function (string $value, int $i, array $tokens) : array {
48
+			'Instagram' => new props('any', function(string $value, int $i, array $tokens) : array {
49 49
 				$parts = \explode(' ', $value, 4);
50 50
 				$data = [
51 51
 					'type' => 'human',
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 			'AppleExchangeWebServices/' => new props('start', $fn['appslash']),
133 133
 			'Google Web Preview' => new props('start', $fn['appslash']),
134 134
 			'MicroMessenger/' => new props('start', $fn['appslash']),
135
-			'weibo' => new props('any', function (string $value) : array {
135
+			'weibo' => new props('any', function(string $value) : array {
136 136
 				$data = [
137 137
 					'app' => 'Weibo',
138 138
 					'appname' => 'Weibo'
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 			}),
150 150
 
151 151
 			// special parser for Facebook app because it is completely different to any other
152
-			'FBAN/' => new props('any', function (string $value) : array {
152
+			'FBAN/' => new props('any', function(string $value) : array {
153 153
 				$map = [
154 154
 					'FBAN/MessengerLiteForiOS' => [
155 155
 						'type' => 'human',
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
 			'FBMD/' => new props('start', fn (string $value) : array => [
205 205
 				'model' => \mb_substr($value, 5)
206 206
 			]),
207
-			'FBDM/' => new props('start', function (string $value) : array {
207
+			'FBDM/' => new props('start', function(string $value) : array {
208 208
 				$data = [];
209 209
 				foreach (\explode(',', \trim(\mb_substr($value, 5), '{}')) AS $item) {
210 210
 					$parts = \explode('=', $item);
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 			'FBSV' => new props('start', fn (string $value) : array => [
233 233
 				'platformversion' => \mb_substr($value, 5)
234 234
 			]),
235
-			'isDarkMode/' => new props('start', function (string $value) : array {
235
+			'isDarkMode/' => new props('start', function(string $value) : array {
236 236
 				$mode = \mb_substr($value, 11);
237 237
 				return [
238 238
 					'darkmode' => \in_array($mode, ['0', '1'], true) ? \boolval($mode) : null
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
 			'NetType/' => new props('start', fn (string $value) : array => [
245 245
 				'nettype' => \mb_convert_case(\mb_substr($value, 8), MB_CASE_UPPER)
246 246
 			]),
247
-			'Microsoft Office' => new props('start', function (string $value, int $i, array $tokens) : array {
247
+			'Microsoft Office' => new props('start', function(string $value, int $i, array $tokens) : array {
248 248
 				$data = [
249 249
 					'type' => 'human'
250 250
 				];
Please login to merge, or discard this patch.
src/mappings/crawlers.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
 class crawlers {
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
 					'category' => 'feed'
224 224
 				]
225 225
 			)),
226
-			'crawler' => function (string $value) : array {
226
+			'crawler' => function(string $value) : array {
227 227
 				$parts = \explode('/', $value, 2);
228 228
 				$map = [
229 229
 					'baiduspider' => 'search',
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
 			'Siteimprove.com' => new props('any', $fn['crawler']),
255 255
 			'CyotekWebCopy' => new props('start', $fn['scraper']),
256 256
 			'Google Page Speed Insights' => new props('exact', $fn['validator']),
257
-			'Qwantify' => new props('start', function (string $value) : array {
257
+			'Qwantify' => new props('start', function(string $value) : array {
258 258
 				$parts = \explode('/', $value, 3);
259 259
 				return [
260 260
 					'type' => 'robot',
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
 			'Uptime/' => new props('start', $fn['monitor']),
286 286
 			'HostTracker/' => new props('start', $fn['monitor']),
287 287
 			'NCSC Web Check [email protected]' => new props('exact', $fn['map']),
288
-			'Pingdom.com' => new props('start', function (string $value) : array {
288
+			'Pingdom.com' => new props('start', function(string $value) : array {
289 289
 				$version = \explode('_', \trim($value, '_'));
290 290
 				return [
291 291
 					'type' => 'robot',
@@ -311,14 +311,14 @@  discard block
 block discarded – undo
311 311
 			'MicrosoftPreview/' => new props('start', $fn['feed']),
312 312
 			'YahooMailProxy' => new props('exact', $fn['feed']),
313 313
 			'PhxBot/' => new props('start', $fn['feed']), // proton mail
314
-			'Pleroma' => new props('start', fn (string $value) : array => [ // mastodon
314
+			'Pleroma' => new props('start', fn (string $value) : array => [// mastodon
315 315
 				'type' => 'robot',
316 316
 				'category' => 'feed',
317 317
 				'app' => 'Mastodon',
318 318
 				'appname' => 'Pleroma',
319 319
 				'appversion' => \mb_substr($value, 8)
320 320
 			]),
321
-			'Outlook-Android/' => new props('start', fn (string $value) : array => [ // mastodon
321
+			'Outlook-Android/' => new props('start', fn (string $value) : array => [// mastodon
322 322
 				'type' => 'robot',
323 323
 				'category' => 'feed',
324 324
 				'app' => 'Outlook',
@@ -326,15 +326,15 @@  discard block
 block discarded – undo
326 326
 				'platform' => 'Android',
327 327
 				'appversion' => \mb_substr($value, 16)
328 328
 			]),
329
-			'Outlook-iOS/' => new props('start', fn (string $value, int $i, array $tokens) : array => [ // mastodon
329
+			'Outlook-iOS/' => new props('start', fn (string $value, int $i, array $tokens) : array => [// mastodon
330 330
 				'type' => 'robot',
331 331
 				'category' => 'feed',
332 332
 				'app' => 'Outlook',
333 333
 				'appname' => 'Outlook-iOS',
334 334
 				'platform' => 'iOS',
335
-				'appversion' => $tokens[$i+1] ?? \mb_substr($value, 12)
335
+				'appversion' => $tokens[$i + 1] ?? \mb_substr($value, 12)
336 336
 			]),
337
-			'OutlookMobileCloudService-Autodetect/' => new props('start', fn (string $value) : array => [ // mastodon
337
+			'OutlookMobileCloudService-Autodetect/' => new props('start', fn (string $value) : array => [// mastodon
338 338
 				'type' => 'robot',
339 339
 				'category' => 'feed',
340 340
 				'app' => 'Outlook',
Please login to merge, or discard this patch.