@@ -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 architectures { |
@@ -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 engines { |
@@ -1,7 +1,7 @@ |
||
1 | 1 | <?php |
2 | -declare(strict_types = 1); |
|
2 | +declare(strict_types=1); |
|
3 | 3 | |
4 | -\spl_autoload_register(function (string $class) : void { |
|
4 | +\spl_autoload_register(function(string $class) : void { |
|
5 | 5 | $classes = [ |
6 | 6 | 'hexydec\\agentzero\\apps' => __DIR__.'/mappings/apps.php', |
7 | 7 | 'hexydec\\agentzero\\architectures' => __DIR__.'/mappings/architectures.php', |
@@ -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 agentzero { |
@@ -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 props { |
@@ -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 other { |
@@ -11,7 +11,7 @@ discard block |
||
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) { |
@@ -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 urls { |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | * @return array<string,props> An array with keys representing the string to match, and values a props object defining how to generate the match and which properties to set |
11 | 11 | */ |
12 | 12 | public static function get() : array { |
13 | - $fn = function (string $value, int $i, array $tokens) : ?array { |
|
13 | + $fn = function(string $value, int $i, array $tokens) : ?array { |
|
14 | 14 | if (($start = \stripos($value, 'http://')) === false) { |
15 | 15 | if (($start = \stripos($value, 'https://')) === false) { |
16 | 16 | $start = \stripos($value, 'www.'); |
@@ -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 config { |
@@ -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 |
@@ -78,7 +78,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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', |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | 'platformversion' => $parts[1] ?? null |
171 | 171 | ]; |
172 | 172 | }), |
173 | - 'KAIOS/' => new props('start', function (string $value, int $i, array $tokens) : array { |
|
173 | + 'KAIOS/' => new props('start', function(string $value, int $i, array $tokens) : array { |
|
174 | 174 | |
175 | 175 | // find device |
176 | 176 | foreach ($tokens AS $i => $item) { |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | 'kernel' => 'unix', |
244 | 244 | 'platform' => 'Solaris', |
245 | 245 | ]), |
246 | - 'AmigaOS' => new props('any', function (string $value) : array { |
|
246 | + 'AmigaOS' => new props('any', function(string $value) : array { |
|
247 | 247 | if (($pos = \mb_stripos($value, 'AmigaOS')) !== false) { |
248 | 248 | $value = \mb_substr($value, $pos); |
249 | 249 | } |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | 'platformversion' => isset($parts[1]) && \strspn($parts[1], '0123456789.-_') === \strlen($parts[1]) ? $parts[1] : null |
257 | 257 | ]; |
258 | 258 | }), |
259 | - 'Fuchsia' => new props('exact', function (string $value, int $i, array $tokens) : array { |
|
259 | + 'Fuchsia' => new props('exact', function(string $value, int $i, array $tokens) : array { |
|
260 | 260 | $os = \explode(' ', $tokens[++$i], 2); |
261 | 261 | return [ |
262 | 262 | 'type' => 'human', |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | 'platformversion' => isset($os[1]) && \strspn($os[1], '0123456789.-_', \strlen($os[0])) === \strlen($os[1]) ? $os[1] : null |
267 | 267 | ]; |
268 | 268 | }), |
269 | - 'Maemo' => new props('exact', function (string $value, int $i, array $tokens) : array { |
|
269 | + 'Maemo' => new props('exact', function(string $value, int $i, array $tokens) : array { |
|
270 | 270 | $os = \explode(' ', $tokens[++$i], 2); |
271 | 271 | return [ |
272 | 272 | 'type' => 'human', |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | 'kernel' => 'Java VM', |
283 | 283 | 'platform' => $value |
284 | 284 | ]), |
285 | - 'Haiku' => new props('any', function (string $value) : array { |
|
285 | + 'Haiku' => new props('any', function(string $value) : array { |
|
286 | 286 | $parts = \explode('/', $value, 2); |
287 | 287 | return [ |
288 | 288 | 'type' => 'human', |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | 'platformversion' => $parts[1] ?? null |
293 | 293 | ]; |
294 | 294 | }), |
295 | - 'BeOS' => new props('start', function (string $value) : array { |
|
295 | + 'BeOS' => new props('start', function(string $value) : array { |
|
296 | 296 | $parts = \explode('/', $value, 2); |
297 | 297 | return [ |
298 | 298 | 'type' => 'human', |
@@ -304,14 +304,14 @@ discard block |
||
304 | 304 | }), |
305 | 305 | 'Android' => new props('exact', $fn['android']), |
306 | 306 | 'Android ' => new props('start', $fn['android']), |
307 | - 'Linux' => new props('any', function (string $value, int $i, array $tokens) : array { |
|
307 | + 'Linux' => new props('any', function(string $value, int $i, array $tokens) : array { |
|
308 | 308 | return [ |
309 | 309 | 'kernel' => 'Linux', |
310 | 310 | 'platform' => 'Linux', |
311 | 311 | 'platformversion' => \str_contains($tokens[$i + 1] ?? '', '.') && \strspn($tokens[$i + 1], '0123456789.') >= 3 ? \explode(' ', $tokens[$i + 1])[0] : null |
312 | 312 | ]; |
313 | 313 | }), |
314 | - 'X11' => new props('exact', function (string $value, int $i, array $tokens) : array { |
|
314 | + 'X11' => new props('exact', function(string $value, int $i, array $tokens) : array { |
|
315 | 315 | $os = \explode(' ', $tokens[++$i] ?? '', 2); |
316 | 316 | return [ |
317 | 317 | 'category' => 'desktop', |