@@ -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 { |
@@ -65,21 +65,21 @@ discard block |
||
65 | 65 | public static function get() : array { |
66 | 66 | $fn = [ |
67 | 67 | 'browserslash' => fn (string $value, int $i, array $tokens, string $key, array $config = []) : array => self::getBrowser($value, $i, $tokens, $key, $config), |
68 | - 'gecko' => function (string $value, int $i, array $tokens, string $key, array $config = []) : array { |
|
68 | + 'gecko' => function(string $value, int $i, array $tokens, string $key, array $config = []) : array { |
|
69 | 69 | $parts = \explode('/', $value, 2); |
70 | 70 | return \array_replace(self::getBrowser($value, $i, $tokens, $key, $config), [ |
71 | 71 | 'engine' => 'Gecko', |
72 | 72 | 'engineversion' => $parts[1] ?? null, |
73 | 73 | ]); |
74 | 74 | }, |
75 | - 'presto' => function (string $value, int $i, array $tokens, string $key, array $config = []) : array { |
|
75 | + 'presto' => function(string $value, int $i, array $tokens, string $key, array $config = []) : array { |
|
76 | 76 | $parts = \explode('/', $value, 2); |
77 | 77 | return \array_replace(self::getBrowser($value, $i, $tokens, $key, $config), [ |
78 | 78 | 'engine' => 'Presto', |
79 | 79 | 'engineversion' => $parts[1] ?? null, |
80 | 80 | ]); |
81 | 81 | }, |
82 | - 'chromium' => function (string $value, int $i, array $tokens, string $key, array $config = []) : array { |
|
82 | + 'chromium' => function(string $value, int $i, array $tokens, string $key, array $config = []) : array { |
|
83 | 83 | $parts = \explode('/', $value, 3); |
84 | 84 | $engineversion = isset($parts[1]) && \strspn($parts[1], '1234567890.') === \strlen($parts[1]) ? $parts[1] : null; |
85 | 85 | return \array_replace(self::getBrowser($value, $i, $tokens, $key, $config), [ |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | 'engineversion' => $engineversion |
88 | 88 | ]); |
89 | 89 | }, |
90 | - 'safari' => function (string $value, int $i, array $tokens, string $key, array $config = []) : array { |
|
90 | + 'safari' => function(string $value, int $i, array $tokens, string $key, array $config = []) : array { |
|
91 | 91 | $parts = \explode('/', $value, 2); |
92 | 92 | $version = $parts[1] ?? null; |
93 | 93 | foreach ($tokens AS $item) { |
@@ -144,10 +144,10 @@ discard block |
||
144 | 144 | 'Namoroka/' => new props('start', $fn['browserslash']), |
145 | 145 | 'CocCoc/' => new props('start', $fn['browserslash']), |
146 | 146 | 'Obigo/' => new props('start', $fn['browserslash']), |
147 | - 'QQBrowser/' => new props('any', function (string $value, int $i, array $tokens, string $key, array $config = []) use ($fn) : array { |
|
147 | + 'QQBrowser/' => new props('any', function(string $value, int $i, array $tokens, string $key, array $config = []) use ($fn) : array { |
|
148 | 148 | return $fn['browserslash'](\mb_substr($value, \mb_stripos($value, 'QQBrowser/') ?: 0), $i, $tokens, $key, $config); // sometimes missing a space from previous declaration, and MQQBrowser for mobile. |
149 | 149 | }), |
150 | - 'MiuiBrowser/' => new props('any', function (string $value, int $i, array $tokens, string $key, array $config = []) use ($fn) : array { |
|
150 | + 'MiuiBrowser/' => new props('any', function(string $value, int $i, array $tokens, string $key, array $config = []) use ($fn) : array { |
|
151 | 151 | return $fn['browserslash'](\mb_substr($value, \mb_stripos($value, 'MiuiBrowser/') ?: 0), $i, $tokens, $key, $config); |
152 | 152 | }), |
153 | 153 | 'Lynx/' => new props('start', fn (string $value) : array => [ |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | 'type' => 'human', |
158 | 158 | 'category' => 'desktop' |
159 | 159 | ]), |
160 | - 'Midori' => new props('start', function (string $value, int $i, array $tokens, string $key, array $config = []) : array { |
|
160 | + 'Midori' => new props('start', function(string $value, int $i, array $tokens, string $key, array $config = []) : array { |
|
161 | 161 | $parts = \explode('/', $value, 2); |
162 | 162 | $version = $parts[1] ?? \explode(' ', $value, 2)[1] ?? null; |
163 | 163 | $major = $version !== null ? \intval($version) : null; |
@@ -177,13 +177,13 @@ discard block |
||
177 | 177 | 'engine' => 'Gecko', |
178 | 178 | 'browser' => 'Firefox' |
179 | 179 | ]), |
180 | - 'Minimo/' => new props('start', function (string $value, int $i, array $tokens, string $key, array $config = []) use ($fn) : array { |
|
180 | + 'Minimo/' => new props('start', function(string $value, int $i, array $tokens, string $key, array $config = []) use ($fn) : array { |
|
181 | 181 | $data = $fn['browserslash']($value, $i, $tokens, $key, $config); |
182 | 182 | return \array_merge($data, [ |
183 | 183 | 'engine' => 'Gecko' |
184 | 184 | ]); |
185 | 185 | }), |
186 | - 'BonEcho/' => new props('start', function (string $value, int $i, array $tokens, string $key, array $config = []) use ($fn) : array { |
|
186 | + 'BonEcho/' => new props('start', function(string $value, int $i, array $tokens, string $key, array $config = []) use ($fn) : array { |
|
187 | 187 | $data = $fn['browserslash']($value, $i, $tokens, $key, $config); |
188 | 188 | return \array_merge($data, [ |
189 | 189 | 'engine' => 'Gecko' |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | 'browserversion' => \mb_substr($value, 9), |
230 | 230 | 'engine' => 'Trident' |
231 | 231 | ], versions::get('ie', \mb_substr($value, 9), $config['versions']))), |
232 | - 'Trident' => new props('start', [ // infill for missing browser name |
|
232 | + 'Trident' => new props('start', [// infill for missing browser name |
|
233 | 233 | 'browser' => 'Internet Explorer' |
234 | 234 | ]), |
235 | 235 | 'Cronet/' => new props('start', $fn['chromium']), |
@@ -1,10 +1,10 @@ |
||
1 | 1 | <?php |
2 | -declare(strict_types = 1); |
|
2 | +declare(strict_types=1); |
|
3 | 3 | namespace hexydec\agentzero; |
4 | 4 | |
5 | 5 | class versions { |
6 | 6 | |
7 | - protected static ?array $versions = null; |
|
7 | + protected static ? array $versions = null; |
|
8 | 8 | |
9 | 9 | protected static function load(string $source, ?string $cache, int $life = 604800) : array|false { |
10 | 10 |