@@ -1,5 +1,5 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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']), |
@@ -1,5 +1,5 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 [ |
@@ -1,5 +1,5 @@ discard block |
||
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 |
||
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; |
@@ -28,7 +28,7 @@ discard block |
||
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 |
||
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', |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | 'Viber/' => new props('start', $fn['appslash']), |
130 | 130 | 'Google Web Preview' => new props('start', $fn['appslash']), |
131 | 131 | 'MicroMessenger/' => new props('start', $fn['appslash']), |
132 | - 'weibo' => new props('any', function (string $value) : array { |
|
132 | + 'weibo' => new props('any', function(string $value) : array { |
|
133 | 133 | $data = [ |
134 | 134 | 'app' => 'Weibo', |
135 | 135 | 'appname' => 'Weibo' |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | }), |
147 | 147 | |
148 | 148 | // special parser for Facebook app because it is completely different to any other |
149 | - 'FBAN/' => new props('any', function (string $value) : array { |
|
149 | + 'FBAN/' => new props('any', function(string $value) : array { |
|
150 | 150 | $map = [ |
151 | 151 | 'FBAN/MessengerLiteForiOS' => [ |
152 | 152 | 'type' => 'human', |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | 'FBMD/' => new props('start', fn (string $value) : array => [ |
202 | 202 | 'model' => \mb_substr($value, 5) |
203 | 203 | ]), |
204 | - 'FBDM/' => new props('start', function (string $value) : array { |
|
204 | + 'FBDM/' => new props('start', function(string $value) : array { |
|
205 | 205 | $data = []; |
206 | 206 | foreach (\explode(',', \trim(\mb_substr($value, 5), '{}')) AS $item) { |
207 | 207 | $parts = \explode('=', $item); |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | 'FBSV' => new props('start', fn (string $value) : array => [ |
230 | 230 | 'platformversion' => \mb_substr($value, 5) |
231 | 231 | ]), |
232 | - 'isDarkMode/' => new props('start', function (string $value) : array { |
|
232 | + 'isDarkMode/' => new props('start', function(string $value) : array { |
|
233 | 233 | $mode = \mb_substr($value, 11); |
234 | 234 | return [ |
235 | 235 | 'darkmode' => \in_array($mode, ['0', '1'], true) ? \boolval($mode) : null |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | 'NetType/' => new props('start', fn (string $value) : array => [ |
242 | 242 | 'nettype' => \mb_convert_case(\mb_substr($value, 8), MB_CASE_UPPER) |
243 | 243 | ]), |
244 | - 'Microsoft Office' => new props('start', function (string $value, int $i, array $tokens) : array { |
|
244 | + 'Microsoft Office' => new props('start', function(string $value, int $i, array $tokens) : array { |
|
245 | 245 | $data = [ |
246 | 246 | 'type' => 'human' |
247 | 247 | ]; |
@@ -1,5 +1,5 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 []; |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | } |
153 | 153 | return $fn['platformwindows']($value, $i, $tokens); |
154 | 154 | }), |
155 | - 'Mac OS X' => new props('any', function (string $value) : array { |
|
155 | + 'Mac OS X' => new props('any', function(string $value) : array { |
|
156 | 156 | $version = \str_replace('_', '.', \mb_substr($value, \mb_stripos($value, 'Mac OS X') + 9)); |
157 | 157 | $register = $version && \intval(\explode('.', $version)[1] ?? 0) >= 6 ? 64 : null; |
158 | 158 | return [ |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | 'platform' => 'iOS', |
184 | 184 | 'platformversion' => \str_replace('_', '.', \mb_substr($value, 4)) |
185 | 185 | ]), |
186 | - 'CrOS' => new props('start', function (string $value) : array { |
|
186 | + 'CrOS' => new props('start', function(string $value) : array { |
|
187 | 187 | $parts = \explode(' ', $value); |
188 | 188 | return [ |
189 | 189 | 'type' => 'human', |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | 'platform' => 'Kindle', |
199 | 199 | 'platformversion' => \mb_substr($value, 7) |
200 | 200 | ]), |
201 | - 'Tizen' => new props('start', function (string $value) : array { |
|
201 | + 'Tizen' => new props('start', function(string $value) : array { |
|
202 | 202 | $parts = \explode(' ', $value, 2); |
203 | 203 | return [ |
204 | 204 | 'type' => 'human', |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | 'platformversion' => $parts[1] ?? null |
209 | 209 | ]; |
210 | 210 | }), |
211 | - 'KAIOS/' => new props('start', function (string $value, int $i, array $tokens) : array { |
|
211 | + 'KAIOS/' => new props('start', function(string $value, int $i, array $tokens) : array { |
|
212 | 212 | |
213 | 213 | // find device |
214 | 214 | foreach ($tokens AS $i => $item) { |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | 'kernel' => 'unix', |
282 | 282 | 'platform' => 'Solaris', |
283 | 283 | ]), |
284 | - 'AmigaOS' => new props('any', function (string $value) : array { |
|
284 | + 'AmigaOS' => new props('any', function(string $value) : array { |
|
285 | 285 | if (($pos = \mb_stripos($value, 'AmigaOS')) !== false) { |
286 | 286 | $value = \mb_substr($value, $pos); |
287 | 287 | } |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | 'platformversion' => isset($parts[1]) && \strspn($parts[1], '0123456789.-_') === \strlen($parts[1]) ? $parts[1] : null |
295 | 295 | ]; |
296 | 296 | }), |
297 | - 'Fuchsia' => new props('exact', function (string $value, int $i, array $tokens) : array { |
|
297 | + 'Fuchsia' => new props('exact', function(string $value, int $i, array $tokens) : array { |
|
298 | 298 | $os = \explode(' ', $tokens[++$i], 2); |
299 | 299 | return [ |
300 | 300 | 'type' => 'human', |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | 'platformversion' => isset($os[1]) && \strspn($os[1], '0123456789.-_', \strlen($os[0])) === \strlen($os[1]) ? $os[1] : null |
305 | 305 | ]; |
306 | 306 | }), |
307 | - 'Maemo' => new props('exact', function (string $value, int $i, array $tokens) : array { |
|
307 | + 'Maemo' => new props('exact', function(string $value, int $i, array $tokens) : array { |
|
308 | 308 | $os = \explode(' ', $tokens[++$i], 2); |
309 | 309 | return [ |
310 | 310 | 'type' => 'human', |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | 'kernel' => 'Java VM', |
321 | 321 | 'platform' => $value |
322 | 322 | ]), |
323 | - 'Haiku' => new props('any', function (string $value) : array { |
|
323 | + 'Haiku' => new props('any', function(string $value) : array { |
|
324 | 324 | $parts = \explode('/', $value, 2); |
325 | 325 | return [ |
326 | 326 | 'type' => 'human', |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | 'platformversion' => $parts[1] ?? null |
331 | 331 | ]; |
332 | 332 | }), |
333 | - 'BeOS' => new props('start', function (string $value) : array { |
|
333 | + 'BeOS' => new props('start', function(string $value) : array { |
|
334 | 334 | $parts = \explode('/', $value, 2); |
335 | 335 | return [ |
336 | 336 | 'type' => 'human', |
@@ -342,14 +342,14 @@ discard block |
||
342 | 342 | }), |
343 | 343 | 'Android' => new props('exact', $fn['android']), |
344 | 344 | 'Android ' => new props('start', $fn['android']), |
345 | - 'Linux' => new props('any', function (string $value, int $i, array $tokens) : array { |
|
345 | + 'Linux' => new props('any', function(string $value, int $i, array $tokens) : array { |
|
346 | 346 | return [ |
347 | 347 | 'kernel' => 'Linux', |
348 | 348 | 'platform' => 'Linux', |
349 | 349 | 'platformversion' => \str_contains($tokens[$i + 1] ?? '', '.') && \strspn($tokens[$i + 1], '0123456789.') >= 3 ? \explode(' ', $tokens[$i + 1])[0] : null |
350 | 350 | ]; |
351 | 351 | }), |
352 | - 'X11' => new props('exact', function (string $value, int $i, array $tokens) : array { |
|
352 | + 'X11' => new props('exact', function(string $value, int $i, array $tokens) : array { |
|
353 | 353 | $os = \explode(' ', $tokens[++$i] ?? '', 2); |
354 | 354 | return [ |
355 | 355 | 'category' => 'desktop', |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -declare(strict_types = 1); |
|
2 | +declare(strict_types=1); |
|
3 | 3 | namespace hexydec\agentzero; |
4 | 4 | |
5 | 5 | class special { |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -declare(strict_types = 1); |
|
2 | +declare(strict_types=1); |
|
3 | 3 | namespace hexydec\agentzero; |
4 | 4 | |
5 | 5 | class crawlers { |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | 'category' => 'feed' |
150 | 150 | ] |
151 | 151 | )), |
152 | - 'crawler' => function (string $value) : array { |
|
152 | + 'crawler' => function(string $value) : array { |
|
153 | 153 | $parts = \explode('/', $value, 2); |
154 | 154 | $map = [ |
155 | 155 | 'baiduspider' => 'search', |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | 'type' => 'robot', |
173 | 173 | 'categpry' => 'scraper' |
174 | 174 | ]), |
175 | - 'Moblie' => new props('exact', [ // some samsung devices mispelt it |
|
175 | + 'Moblie' => new props('exact', [// some samsung devices mispelt it |
|
176 | 176 | 'type' => 'robot', |
177 | 177 | 'category' => 'scraper' |
178 | 178 | ]), |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | 'Siteimprove.com' => new props('any', $fn['crawler']), |
193 | 193 | 'SEOlyt/' => new props('any', $fn['crawler']), |
194 | 194 | 'CyotekWebCopy' => new props('start', $fn['scraper']), |
195 | - 'Yandex' => new props('start', function (string $value) : array { |
|
195 | + 'Yandex' => new props('start', function(string $value) : array { |
|
196 | 196 | $parts = \explode('/', $value, 3); |
197 | 197 | return [ |
198 | 198 | 'type' => 'robot', |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | ]; |
204 | 204 | }), |
205 | 205 | 'Google Page Speed Insights' => new props('exact', $fn['validator']), |
206 | - 'Qwantify' => new props('start', function (string $value) : array { |
|
206 | + 'Qwantify' => new props('start', function(string $value) : array { |
|
207 | 207 | $parts = \explode('/', $value, 3); |
208 | 208 | return [ |
209 | 209 | 'type' => 'robot', |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | 'Uptime/' => new props('start', $fn['monitor']), |
249 | 249 | 'HostTracker/' => new props('start', $fn['monitor']), |
250 | 250 | 'NCSC Web Check [email protected]' => new props('exact', $fn['monitor']), |
251 | - 'Pingdom.com' => new props('start', function (string $value) : array { |
|
251 | + 'Pingdom.com' => new props('start', function(string $value) : array { |
|
252 | 252 | $version = \explode('_', \trim($value, '_')); |
253 | 253 | return [ |
254 | 254 | 'type' => 'robot', |
@@ -277,14 +277,14 @@ discard block |
||
277 | 277 | 'PhxBot/' => new props('start', $fn['feed']), // proton mail |
278 | 278 | 'Embedly/' => new props('start', $fn['feed']), |
279 | 279 | 'PayPal IPN' => new props('exact', $fn['feed']), |
280 | - 'Pleroma' => new props('start', fn (string $value) : array => [ // mastodon |
|
280 | + 'Pleroma' => new props('start', fn (string $value) : array => [// mastodon |
|
281 | 281 | 'type' => 'robot', |
282 | 282 | 'category' => 'feed', |
283 | 283 | 'app' => 'Mastodon', |
284 | 284 | 'appname' => 'Pleroma', |
285 | 285 | 'appversion' => \mb_substr($value, 8) |
286 | 286 | ]), |
287 | - 'Outlook-Android/' => new props('start', fn (string $value) : array => [ // mastodon |
|
287 | + 'Outlook-Android/' => new props('start', fn (string $value) : array => [// mastodon |
|
288 | 288 | 'type' => 'robot', |
289 | 289 | 'category' => 'feed', |
290 | 290 | 'app' => 'Outlook', |
@@ -292,13 +292,13 @@ discard block |
||
292 | 292 | 'platform' => 'Android', |
293 | 293 | 'appversion' => \mb_substr($value, 16) |
294 | 294 | ]), |
295 | - 'Outlook-iOS/' => new props('start', fn (string $value, int $i, array $tokens) : array => [ // mastodon |
|
295 | + 'Outlook-iOS/' => new props('start', fn (string $value, int $i, array $tokens) : array => [// mastodon |
|
296 | 296 | 'type' => 'robot', |
297 | 297 | 'category' => 'feed', |
298 | 298 | 'app' => 'Outlook', |
299 | 299 | 'appname' => 'Outlook-iOS', |
300 | 300 | 'platform' => 'iOS', |
301 | - 'appversion' => $tokens[$i+1] ?? \mb_substr($value, 12) |
|
301 | + 'appversion' => $tokens[$i + 1] ?? \mb_substr($value, 12) |
|
302 | 302 | ]), |
303 | 303 | 'OutlookMobileCloudService-Autodetect/' => new props('start', fn (string $value) : array => [ |
304 | 304 | 'type' => 'robot', |
@@ -307,11 +307,11 @@ discard block |
||
307 | 307 | 'appname' => 'OutlookMobileCloudService-Autodetect', |
308 | 308 | 'appversion' => \mb_substr($value, 37) |
309 | 309 | ]), |
310 | - 'HubSpot Connect ' => new props('start', function (string $value, int $i, array $tokens) : array { |
|
310 | + 'HubSpot Connect ' => new props('start', function(string $value, int $i, array $tokens) : array { |
|
311 | 311 | $app = 'HubSpot Connect'; |
312 | 312 | for ($n = $i; $n < \count($tokens); $n++) { |
313 | 313 | if (\str_starts_with($tokens[$n], 'namespace: ')) { |
314 | - $app = \mb_substr($tokens[$n], 11).' - '.$tokens[$n+1]; |
|
314 | + $app = \mb_substr($tokens[$n], 11).' - '.$tokens[$n + 1]; |
|
315 | 315 | break; |
316 | 316 | } |
317 | 317 | } |
@@ -341,8 +341,8 @@ discard block |
||
341 | 341 | 'GoogleDocs' => new props('exact', fn (string $value, int $i, array $tokens) : array => [ |
342 | 342 | 'type' => 'robot', |
343 | 343 | 'category' => 'feed', |
344 | - 'app' => 'Google Docs ('.\mb_convert_case(\str_ireplace('apps-', '', $tokens[$i+1]), MB_CASE_TITLE).')', |
|
345 | - 'appname' => $value.'; '.$tokens[$i+1] |
|
344 | + 'app' => 'Google Docs ('.\mb_convert_case(\str_ireplace('apps-', '', $tokens[$i + 1]), MB_CASE_TITLE).')', |
|
345 | + 'appname' => $value.'; '.$tokens[$i + 1] |
|
346 | 346 | ]), |
347 | 347 | 'Google-Lens' => new props('exact', $fn['feed']), |
348 | 348 | 'ManicTime/' => new props('start', $fn['feed']), |
@@ -1,5 +1,5 @@ discard block |
||
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 |
||
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 = []; |