@@ -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 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types = 1); |
|
| 2 | +declare(strict_types=1); |
|
| 3 | 3 | namespace hexydec\agentzero; |
| 4 | 4 | |
| 5 | 5 | /** |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | */ |
| 15 | 15 | public static function get() : array { |
| 16 | 16 | $fn = [ |
| 17 | - 'appslash' => function (string $value) : ?array { |
|
| 17 | + 'appslash' => function(string $value) : ?array { |
|
| 18 | 18 | if (!\str_starts_with($value, 'AppleWebKit') && !\str_contains($value, '://')) { |
| 19 | 19 | $parts = \explode('/', $value, 2); |
| 20 | 20 | return [ |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | ], |
| 33 | 33 | 'Instagram' => [ |
| 34 | 34 | 'match' => 'any', |
| 35 | - 'categories' => function (string $value, int $i, array $tokens) : array { |
|
| 35 | + 'categories' => function(string $value, int $i, array $tokens) : array { |
|
| 36 | 36 | $data = [ |
| 37 | 37 | 'app' => 'Instagram', |
| 38 | 38 | 'appversion' => \explode(' ', $value, 3)[1] ?? null |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | // special parser for Facebook app because it is completely different to any other |
| 80 | 80 | 'FBAN/' => [ |
| 81 | 81 | 'match' => 'start', |
| 82 | - 'categories' => function (string $value) : array { |
|
| 82 | + 'categories' => function(string $value) : array { |
|
| 83 | 83 | $map = [ |
| 84 | 84 | 'FBAN/MessengerLiteForiOS' => [ |
| 85 | 85 | 'type' => 'human', |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | ], |
| 153 | 153 | 'FBDM/' => [ |
| 154 | 154 | 'match' => 'start', |
| 155 | - 'categories' => function (string $value) : array { |
|
| 155 | + 'categories' => function(string $value) : array { |
|
| 156 | 156 | $data = []; |
| 157 | 157 | foreach (\explode(',', \trim(\mb_substr($value, 5), '{}')) AS $item) { |
| 158 | 158 | $parts = \explode('=', $item); |
@@ -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 | /** |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | 'crawler' => fn (string $value) : array => self::getApp($value, ['category' => 'crawler']), |
| 47 | 47 | 'monitor' => fn (string $value) : array => self::getApp($value, ['category' => 'monitor']), |
| 48 | 48 | 'scraper' => fn (string $value) : array => self::getApp($value, ['category' => 'scraper']), |
| 49 | - 'map' => function (string $value, int $i, array $tokens) : ?array { |
|
| 49 | + 'map' => function(string $value, int $i, array $tokens) : ?array { |
|
| 50 | 50 | if (!\str_contains($value, '://')) { // bot will be in the URL |
| 51 | 51 | $parts = \explode('/', $value, 2); |
| 52 | 52 | $category = [ |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | ], |
| 172 | 172 | 'Pingdom.com' => [ |
| 173 | 173 | 'match' => 'start', |
| 174 | - 'categories' => function (string $value) : array { |
|
| 174 | + 'categories' => function(string $value) : array { |
|
| 175 | 175 | $version = \explode('_', \trim($value, '_')); |
| 176 | 176 | return [ |
| 177 | 177 | 'type' => 'robot', |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | ], |
| 253 | 253 | 'Microsoft Office' => [ |
| 254 | 254 | 'match' => 'start', |
| 255 | - 'categories' => function (string $value, int $i, array $tokens) : array { |
|
| 255 | + 'categories' => function(string $value, int $i, array $tokens) : array { |
|
| 256 | 256 | $data = [ |
| 257 | 257 | 'type' => 'robot', |
| 258 | 258 | 'category' => '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 | /** |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | return [ |
| 17 | 17 | '{' => [ |
| 18 | 18 | 'match' => 'any', |
| 19 | - 'categories' => function (string $value) : ?array { |
|
| 19 | + 'categories' => function(string $value) : ?array { |
|
| 20 | 20 | if (($start = \mb_strpos($value, '{')) === false) { |
| 21 | 21 | |
| 22 | 22 | } 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 | /** |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | */ |
| 15 | 15 | public static function get() : array { |
| 16 | 16 | $fn = [ |
| 17 | - 'ios' => function (string $value, int $i, array $tokens) : array { |
|
| 17 | + 'ios' => function(string $value, int $i, array $tokens) : array { |
|
| 18 | 18 | $version = null; |
| 19 | 19 | $model = null; |
| 20 | 20 | foreach ($tokens AS $item) { |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | 'category' => 'console', |
| 46 | 46 | 'vendor' => 'Microsoft', |
| 47 | 47 | ], |
| 48 | - 'playstation' => function (string $value) : array { |
|
| 48 | + 'playstation' => function(string $value) : array { |
|
| 49 | 49 | $parts = \explode(' ', $value); |
| 50 | 50 | if (\str_contains($parts[1], '/')) { |
| 51 | 51 | list($parts[1], $parts[2]) = \explode('/', $parts[1]); |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | ], |
| 284 | 284 | 'SAMSUNG-' => [ |
| 285 | 285 | 'match' => 'start', |
| 286 | - 'categories' => function (string $value) : array { |
|
| 286 | + 'categories' => function(string $value) : array { |
|
| 287 | 287 | $parts = \explode('/', $value, 2); |
| 288 | 288 | return [ |
| 289 | 289 | 'device' => \mb_substr($parts[0], 8), |
@@ -308,7 +308,7 @@ discard block |
||
| 308 | 308 | ], |
| 309 | 309 | 'SonyEricsson' => [ |
| 310 | 310 | 'match' => 'start', |
| 311 | - 'categories' => function (string $value) : array { |
|
| 311 | + 'categories' => function(string $value) : array { |
|
| 312 | 312 | $parts = \explode('/', $value, 2); |
| 313 | 313 | return [ |
| 314 | 314 | 'type' => 'human', |
@@ -321,7 +321,7 @@ discard block |
||
| 321 | 321 | ], |
| 322 | 322 | 'LGE' => [ |
| 323 | 323 | 'match' => 'exact', |
| 324 | - 'categories' => function (string $value, int $i, array $tokens) : array { |
|
| 324 | + 'categories' => function(string $value, int $i, array $tokens) : array { |
|
| 325 | 325 | $device = $tokens[++$i] ?? null; |
| 326 | 326 | $platformversion = $tokens[++$i] ?? null; |
| 327 | 327 | $build = $tokens[++$i] ?? null; |
@@ -337,7 +337,7 @@ discard block |
||
| 337 | 337 | ], |
| 338 | 338 | 'NOKIA' => [ |
| 339 | 339 | 'match' => 'start', |
| 340 | - 'categories' => function (string $value) : array { |
|
| 340 | + 'categories' => function(string $value) : array { |
|
| 341 | 341 | $parts = \explode('/', $value, 2); |
| 342 | 342 | $device = \trim(\mb_substr($parts[0], 5, \str_ends_with($parts[0], ' Build') ? -6 : null)); |
| 343 | 343 | return [ |
@@ -377,7 +377,7 @@ discard block |
||
| 377 | 377 | ], |
| 378 | 378 | 'ThinkPad' => [ |
| 379 | 379 | 'match' => 'start', |
| 380 | - 'categories' => function (string $value, int $i, array $tokens) : array { |
|
| 380 | + 'categories' => function(string $value, int $i, array $tokens) : array { |
|
| 381 | 381 | if (\mb_strpos($tokens[++$i] ?? '', 'Build/') === 0) { |
| 382 | 382 | $device = \explode('_', \mb_substr($tokens[$i], 6)); |
| 383 | 383 | } |
@@ -398,7 +398,7 @@ discard block |
||
| 398 | 398 | ], |
| 399 | 399 | 'Build/' => [ |
| 400 | 400 | 'match' => 'any', |
| 401 | - 'categories' => function (string $value) : array { |
|
| 401 | + 'categories' => function(string $value) : array { |
|
| 402 | 402 | return self::getDevice($value); |
| 403 | 403 | } |
| 404 | 404 | ], |
@@ -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 | /** |
@@ -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 | /** |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | ]; |
| 138 | 138 | $fn = [ |
| 139 | 139 | 'match' => 'start', |
| 140 | - 'categories' => function (string $value, int $i , array $tokens, string $match) : ?array { |
|
| 140 | + 'categories' => function(string $value, int $i, array $tokens, string $match) : ?array { |
|
| 141 | 141 | if ($value === $match) { |
| 142 | 142 | return ['language' => $value]; |
| 143 | 143 | } else { |
@@ -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 | /** |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | * @return MatchConfig An array with keys representing the string to match, and a value of an array containing parsing and output settings |
| 14 | 14 | */ |
| 15 | 15 | public static function get() : array { |
| 16 | - $fn = function (string $value, int $i, array $tokens) : ?array { |
|
| 16 | + $fn = function(string $value, int $i, array $tokens) : ?array { |
|
| 17 | 17 | if (($start = \stripos($value, 'http://')) === false) { |
| 18 | 18 | if (($start = \stripos($value, 'https://')) === false) { |
| 19 | 19 | $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 | /** |