@@ -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 crawlers { |
@@ -48,7 +48,7 @@ discard block |
||
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 |
||
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 |
||
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', |
@@ -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 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 | foreach ($tokens AS $item) { |
@@ -43,7 +43,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 [ |
@@ -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 | } |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | } |
48 | 48 | return $data; |
49 | 49 | }, |
50 | - 'presto' => function (string $value) : array { |
|
50 | + 'presto' => function(string $value) : array { |
|
51 | 51 | $parts = \explode('/', $value, 2); |
52 | 52 | return [ |
53 | 53 | 'type' => 'human', |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | 'engineversion' => $parts[1] ?? null |
58 | 58 | ]; |
59 | 59 | }, |
60 | - 'chromium' => function (string $value) : array { |
|
60 | + 'chromium' => function(string $value) : array { |
|
61 | 61 | $parts = \explode('/', $value, 3); |
62 | 62 | return [ |
63 | 63 | 'type' => 'human', |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | 'engineversion' => isset($parts[1]) && \strspn($parts[1], '1234567890.') === \strlen($parts[1]) ? $parts[1] : null |
68 | 68 | ]; |
69 | 69 | }, |
70 | - 'safari' => function (string $value, int $i, array $tokens) : array { |
|
70 | + 'safari' => function(string $value, int $i, array $tokens) : array { |
|
71 | 71 | $version = null; |
72 | 72 | foreach ($tokens AS $item) { |
73 | 73 | if (\mb_stripos($item, 'Version/') === 0) { |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | 'type' => 'human', |
135 | 135 | 'category' => 'desktop' |
136 | 136 | ]), |
137 | - 'Midori' => new props('start', function (string $value) : array { |
|
137 | + 'Midori' => new props('start', function(string $value) : array { |
|
138 | 138 | $parts = \explode('/', $value, 2); |
139 | 139 | return [ |
140 | 140 | 'type' => 'human', |
@@ -150,14 +150,14 @@ discard block |
||
150 | 150 | 'browserversion' => \mb_substr($value, 7), |
151 | 151 | 'engineversion' => \mb_substr($value, 7) |
152 | 152 | ]), |
153 | - 'Firefox/' => new props('start', function (string $value) use ($fn) : array { |
|
153 | + 'Firefox/' => new props('start', function(string $value) use ($fn) : array { |
|
154 | 154 | $data = $fn['browserslash']($value); |
155 | 155 | return \array_merge($data, [ |
156 | 156 | 'engine' => 'Gecko', |
157 | 157 | 'engineversion' => $data['browserversion'] ?? null |
158 | 158 | ]); |
159 | 159 | }), |
160 | - ' Firefox/' => new props('any', function (string $value) use ($fn) : array { |
|
160 | + ' Firefox/' => new props('any', function(string $value) use ($fn) : array { |
|
161 | 161 | $data = $fn['browserslash']($value); |
162 | 162 | return \array_merge($data, [ |
163 | 163 | 'engine' => 'Gecko', |
@@ -169,13 +169,13 @@ discard block |
||
169 | 169 | 'engine' => 'Gecko', |
170 | 170 | 'browser' => 'Firefox' |
171 | 171 | ]), |
172 | - 'Minimo/' => new props('start', function (string $value) use ($fn) : array { |
|
172 | + 'Minimo/' => new props('start', function(string $value) use ($fn) : array { |
|
173 | 173 | $data = $fn['browserslash']($value); |
174 | 174 | return \array_merge($data, [ |
175 | 175 | 'engine' => 'Gecko' |
176 | 176 | ]); |
177 | 177 | }), |
178 | - 'BonEcho/' => new props('start', function (string $value) use ($fn) : array { |
|
178 | + 'BonEcho/' => new props('start', function(string $value) use ($fn) : array { |
|
179 | 179 | $data = $fn['browserslash']($value); |
180 | 180 | return \array_merge($data, [ |
181 | 181 | 'engine' => 'Gecko' |