Passed
Push — main ( daa201...f8ebda )
by Will
03:08
created
src/mappings/browsers.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types = 1);
2
+declare(strict_types=1);
3 3
 namespace hexydec\agentzero;
4 4
 
5 5
 class browsers {
@@ -67,21 +67,21 @@  discard block
 block discarded – undo
67 67
 	public static function get() : array {
68 68
 		$fn = [
69 69
 			'browserslash' => fn (string $value, int $i, array $tokens, string $key, array $config = []) : array => self::getBrowser($value, $i, $tokens, $key, $config),
70
-			'gecko' => function (string $value, int $i, array $tokens, string $key, array $config = []) : array {
70
+			'gecko' => function(string $value, int $i, array $tokens, string $key, array $config = []) : array {
71 71
 				$parts = \explode('/', $value, 2);
72 72
 				return \array_replace(self::getBrowser($value, $i, $tokens, $key, $config), [
73 73
 					'engine' => 'Gecko',
74 74
 					'engineversion' => $parts[1] ?? null,
75 75
 				]);
76 76
 			},
77
-			'presto' => function (string $value, int $i, array $tokens, string $key, array $config = []) : array {
77
+			'presto' => function(string $value, int $i, array $tokens, string $key, array $config = []) : array {
78 78
 				$parts = \explode('/', $value, 2);
79 79
 				return \array_replace(self::getBrowser($value, $i, $tokens, $key, $config), [
80 80
 					'engine' => 'Presto',
81 81
 					'engineversion' => $parts[1] ?? null,
82 82
 				]);
83 83
 			},
84
-			'chromium' => function (string $value, int $i, array $tokens, string $key, array $config = []) : array {
84
+			'chromium' => function(string $value, int $i, array $tokens, string $key, array $config = []) : array {
85 85
 				$parts = \explode('/', $value, 3);
86 86
 				$engineversion = isset($parts[1]) && \strspn($parts[1], '1234567890.') === \strlen($parts[1]) ? $parts[1] : null;
87 87
 				return \array_replace(self::getBrowser($value, $i, $tokens, $key, $config), [
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 					'engineversion' => $engineversion
90 90
 				]);
91 91
 			},
92
-			'safari' => function (string $value, int $i, array $tokens, string $key, array $config = []) : array {
92
+			'safari' => function(string $value, int $i, array $tokens, string $key, array $config = []) : array {
93 93
 				$parts = \explode('/', $value, 2);
94 94
 				$version = $parts[1] ?? null;
95 95
 				foreach ($tokens AS $item) {
@@ -148,10 +148,10 @@  discard block
 block discarded – undo
148 148
 			'Obigo/' => new props('start', $fn['browserslash']),
149 149
 			'VivoBrowser/' => new props('start', $fn['browserslash']),
150 150
 			'com.vivo.browser/' => new props('any', $fn['browserslash']),
151
-			'QQBrowser/' => new props('any', function (string $value, int $i, array $tokens, string $key, array $config = []) use ($fn) : array {
151
+			'QQBrowser/' => new props('any', function(string $value, int $i, array $tokens, string $key, array $config = []) use ($fn) : array {
152 152
 				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.
153 153
 			}),
154
-			'MiuiBrowser/' => new props('any', function (string $value, int $i, array $tokens, string $key, array $config = []) use ($fn) : array {
154
+			'MiuiBrowser/' => new props('any', function(string $value, int $i, array $tokens, string $key, array $config = []) use ($fn) : array {
155 155
 				return $fn['browserslash'](\mb_substr($value, \mb_stripos($value, 'MiuiBrowser/') ?: 0), $i, $tokens, $key, $config);
156 156
 			}),
157 157
 			'Lynx/' => new props('start', fn (string $value) : array => [
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 				'type' => 'human',
162 162
 				'category' => 'desktop'
163 163
 			]),
164
-			'Midori' => new props('start', function (string $value, int $i, array $tokens, string $key, array $config = []) : array {
164
+			'Midori' => new props('start', function(string $value, int $i, array $tokens, string $key, array $config = []) : array {
165 165
 				$parts = \explode('/', $value, 2);
166 166
 				$version = $parts[1] ?? \explode(' ', $value, 2)[1] ?? null;
167 167
 				$major = $version !== null ? \intval($version) : null;
@@ -181,13 +181,13 @@  discard block
 block discarded – undo
181 181
 				'engine' => 'Gecko',
182 182
 				'browser' => 'Firefox'
183 183
 			]),
184
-			'Minimo/' => new props('start', function (string $value, int $i, array $tokens, string $key, array $config = []) use ($fn) : array {
184
+			'Minimo/' => new props('start', function(string $value, int $i, array $tokens, string $key, array $config = []) use ($fn) : array {
185 185
 				$data = $fn['browserslash']($value, $i, $tokens, $key, $config);
186 186
 				return \array_merge($data, [
187 187
 					'engine' => 'Gecko'
188 188
 				]);
189 189
 			}),
190
-			'BonEcho/' => new props('start', function (string $value, int $i, array $tokens, string $key, array $config = []) use ($fn) : array {
190
+			'BonEcho/' => new props('start', function(string $value, int $i, array $tokens, string $key, array $config = []) use ($fn) : array {
191 191
 				$data = $fn['browserslash']($value, $i, $tokens, $key, $config);
192 192
 				return \array_merge($data, [
193 193
 					'engine' => 'Gecko'
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 				'browserversion' => \mb_substr($value, 9),
234 234
 				'engine' => 'Trident'
235 235
 			], versions::get('ie', \mb_substr($value, 9), $config))),
236
-			'Trident' => new props('start', [ // infill for missing browser name
236
+			'Trident' => new props('start', [// infill for missing browser name
237 237
 				'browser' => 'Internet Explorer'
238 238
 			]),
239 239
 			'Cronet/' => new props('start', $fn['chromium']),
Please login to merge, or discard this patch.
src/helpers/hints.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types = 1);
2
+declare(strict_types=1);
3 3
 namespace hexydec\agentzero;
4 4
 
5 5
 class hints {
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 		$map = [
16 16
 			'sec-ch-ua-mobile' => fn (\stdClass $obj, string $value) : string => $obj->category = $value === '?1' ? 'mobile' : 'desktop',
17 17
 			'sec-ch-ua-platform' => fn (\stdClass $obj, string $value) : ?string => $obj->platform = \trim($value, '"') ?: null,
18
-			'sec-ch-ua-platform-version' => function (\stdClass $obj, string $value) : void {
18
+			'sec-ch-ua-platform-version' => function(\stdClass $obj, string $value) : void {
19 19
 				$value = \trim($value, '"');
20 20
 				if (($obj->platform ?? null) === 'Windows') {
21 21
 					$map = [
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 				$obj->platformversion = $value ?: null;
43 43
 			},
44 44
 			'sec-ch-ua-model' => fn (\stdClass $obj, string $value) : ?string => $obj->model = \trim($value, '"') ?: null,
45
-			'sec-ch-ua-full-version-list' => function (\stdClass $obj, string $value, string &$ua) : void {
45
+			'sec-ch-ua-full-version-list' => function(\stdClass $obj, string $value, string &$ua) : void {
46 46
 				$brands = [];
47 47
 
48 48
 				// process brands string
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 				// sort the values in importance order
64 64
 				$sort = ['Chromium', 'Google Chrome'];
65 65
 				$count = \count($sort);
66
-				\uksort($brands, function (string $a, string $b) use ($sort, $count) : int {
66
+				\uksort($brands, function(string $a, string $b) use ($sort, $count) : int {
67 67
 					$aval = $bval = $count;
68 68
 					foreach ($sort AS $key => $item) {
69 69
 						if ($a === $item) {
Please login to merge, or discard this patch.