@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | public function get(string $key, mixed $default = null): mixed |
51 | 51 | { |
52 | 52 | $key = $this->_key($key); |
53 | - if (! isset($this->data[$key])) { |
|
53 | + if (!isset($this->data[$key])) { |
|
54 | 54 | return $default; |
55 | 55 | } |
56 | 56 | $data = $this->data[$key]; |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | |
125 | 125 | foreach ($this->_config['groups'] as $group) { |
126 | 126 | $key = $this->_config['prefix'] . $group; |
127 | - if (! isset($this->data[$key])) { |
|
127 | + if (!isset($this->data[$key])) { |
|
128 | 128 | $this->data[$key] = ['exp' => PHP_INT_MAX, 'val' => 1]; |
129 | 129 | } |
130 | 130 | $value = $this->data[$key]['val']; |
@@ -85,11 +85,11 @@ discard block |
||
85 | 85 | { |
86 | 86 | $this->setConfig($config); |
87 | 87 | |
88 | - if (! empty($this->_config['groups'])) { |
|
88 | + if (!empty($this->_config['groups'])) { |
|
89 | 89 | sort($this->_config['groups']); |
90 | 90 | $this->_groupPrefix = str_repeat('%s_', count($this->_config['groups'])); |
91 | 91 | } |
92 | - if (! is_numeric($this->_config['duration'])) { |
|
92 | + if (!is_numeric($this->_config['duration'])) { |
|
93 | 93 | $this->_config['duration'] = strtotime($this->_config['duration']) - time(); |
94 | 94 | } |
95 | 95 | |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | */ |
112 | 112 | public function ensureValidKey(string $key): void |
113 | 113 | { |
114 | - if (! is_string($key) || $key === '') { |
|
114 | + if (!is_string($key) || $key === '') { |
|
115 | 115 | throw new InvalidArgumentException('Une clé de cache doit être une chaîne non vide.'); |
116 | 116 | } |
117 | 117 | |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | */ |
132 | 132 | protected function ensureValidType($iterable, string $check = self::CHECK_VALUE): void |
133 | 133 | { |
134 | - if (! is_iterable($iterable)) { |
|
134 | + if (!is_iterable($iterable)) { |
|
135 | 135 | throw new InvalidArgumentException(sprintf( |
136 | 136 | 'Un cache %s doit être soit un tableau soit un Traversable.', |
137 | 137 | $check === self::CHECK_VALUE ? 'key set' : 'set' |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | $result = true; |
261 | 261 | |
262 | 262 | foreach ($keys as $key) { |
263 | - if (! $this->delete($key)) { |
|
263 | + if (!$this->delete($key)) { |
|
264 | 264 | $result = false; |
265 | 265 | } |
266 | 266 | } |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | */ |
34 | 34 | public function init(array $config = []): bool |
35 | 35 | { |
36 | - if (! extension_loaded('apcu')) { |
|
36 | + if (!extension_loaded('apcu')) { |
|
37 | 37 | throw new RuntimeException('L\'extension `apcu` doit être activée pour utiliser ApcuHandler.'); |
38 | 38 | } |
39 | 39 | |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | $groups = apcu_fetch($this->_compiledGroupNames, $success); |
163 | 163 | if ($success && count($groups) !== count($this->_config['groups'])) { |
164 | 164 | foreach ($this->_compiledGroupNames as $group) { |
165 | - if (! isset($groups[$group])) { |
|
165 | + if (!isset($groups[$group])) { |
|
166 | 166 | $value = 1; |
167 | 167 | if (apcu_store($group, $value) === false) { |
168 | 168 | $this->warning( |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | */ |
33 | 33 | public function init(array $config = []): bool |
34 | 34 | { |
35 | - if (! extension_loaded('wincache')) { |
|
35 | + if (!extension_loaded('wincache')) { |
|
36 | 36 | throw new RuntimeException('L\'extension `wincache` doit être activée pour utiliser WincacheHandler.'); |
37 | 37 | } |
38 | 38 | |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | $groups = wincache_ucache_get($this->_compiledGroupNames); |
136 | 136 | if (count($groups) !== count($this->_config['groups'])) { |
137 | 137 | foreach ($this->_compiledGroupNames as $group) { |
138 | - if (! isset($groups[$group])) { |
|
138 | + if (!isset($groups[$group])) { |
|
139 | 139 | wincache_ucache_set($group, 1); |
140 | 140 | $groups[$group] = 1; |
141 | 141 | } |
@@ -102,16 +102,16 @@ discard block |
||
102 | 102 | */ |
103 | 103 | protected function factory(): CacheInterface |
104 | 104 | { |
105 | - if (! static::$_enabled) { |
|
105 | + if (!static::$_enabled) { |
|
106 | 106 | return new Dummy(); |
107 | 107 | } |
108 | - if (! empty($this->adapter)) { |
|
108 | + if (!empty($this->adapter)) { |
|
109 | 109 | return $this->adapter; |
110 | 110 | } |
111 | 111 | |
112 | 112 | $validHandlers = $this->config['valid_handlers'] ?? self::$validHandlers; |
113 | 113 | |
114 | - if (empty($validHandlers) || ! is_array($validHandlers)) { |
|
114 | + if (empty($validHandlers) || !is_array($validHandlers)) { |
|
115 | 115 | throw new InvalidArgumentException('La configuration du cache doit avoir un tableau de $valid_handlers.'); |
116 | 116 | } |
117 | 117 | |
@@ -122,26 +122,26 @@ discard block |
||
122 | 122 | throw new InvalidArgumentException('La configuration du cache doit avoir un ensemble de gestionnaires.'); |
123 | 123 | } |
124 | 124 | |
125 | - if (! array_key_exists($handler, $validHandlers)) { |
|
125 | + if (!array_key_exists($handler, $validHandlers)) { |
|
126 | 126 | throw new InvalidArgumentException('La configuration du cache a un gestionnaire non valide spécifié.'); |
127 | 127 | } |
128 | 128 | |
129 | 129 | $adapter = new $validHandlers[$handler](); |
130 | - if (! ($adapter instanceof BaseHandler)) { |
|
130 | + if (!($adapter instanceof BaseHandler)) { |
|
131 | 131 | if (empty($fallback)) { |
132 | 132 | $adapter = new Dummy(); |
133 | - } elseif (! array_key_exists($fallback, $validHandlers)) { |
|
133 | + } elseif (!array_key_exists($fallback, $validHandlers)) { |
|
134 | 134 | throw new InvalidArgumentException('La configuration du cache a un gestionnaire de secours non valide spécifié.'); |
135 | 135 | } else { |
136 | 136 | $adapter = new $validHandlers[$fallback](); |
137 | 137 | } |
138 | 138 | } |
139 | 139 | |
140 | - if (! ($adapter instanceof BaseHandler)) { |
|
140 | + if (!($adapter instanceof BaseHandler)) { |
|
141 | 141 | throw new InvalidArgumentException('Le gestionnaire de cache doit utiliser BlitzPHP\Cache\Handlers\BaseHandler comme classe de base.'); |
142 | 142 | } |
143 | 143 | |
144 | - if (! $adapter->init($this->config)) { |
|
144 | + if (!$adapter->init($this->config)) { |
|
145 | 145 | throw new RuntimeException( |
146 | 146 | sprintf( |
147 | 147 | 'Le moteur de cache %s n\'est pas correctement configuré. Consultez le journal des erreurs pour plus d\'informations.', |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | { |
37 | 37 | static $_is_php; |
38 | 38 | |
39 | - if (! isset($_is_php[$version])) { |
|
39 | + if (!isset($_is_php[$version])) { |
|
40 | 40 | $_is_php[$version] = version_compare(PHP_VERSION, $version, '>='); |
41 | 41 | } |
42 | 42 | |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | */ |
49 | 49 | public static function isAjaxRequest(): bool |
50 | 50 | { |
51 | - return ! empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) === 'xmlhttprequest'; |
|
51 | + return !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) === 'xmlhttprequest'; |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | /** |
@@ -74,13 +74,13 @@ discard block |
||
74 | 74 | $host = explode(':', $_SERVER['HTTP_HOST'] ?? '')[0]; |
75 | 75 | |
76 | 76 | return |
77 | - ! empty($host) // Si c'est vide, ca veut certainement dire qu'on est en CLI, or le CLI << n'est pas >> utilisé en ligne |
|
78 | - && ! in_array($host, ['localhost', '127.0.0.1'], true) |
|
79 | - && ! preg_match('#\.dev$#', $host) |
|
80 | - && ! preg_match('#\.test$#', $host) |
|
81 | - && ! preg_match('#\.lab$#', $host) |
|
82 | - && ! preg_match('#\.loc(al)?$#', $host) |
|
83 | - && ! preg_match('#^192\.168#', $host); |
|
77 | + !empty($host) // Si c'est vide, ca veut certainement dire qu'on est en CLI, or le CLI << n'est pas >> utilisé en ligne |
|
78 | + && !in_array($host, ['localhost', '127.0.0.1'], true) |
|
79 | + && !preg_match('#\.dev$#', $host) |
|
80 | + && !preg_match('#\.test$#', $host) |
|
81 | + && !preg_match('#\.lab$#', $host) |
|
82 | + && !preg_match('#\.loc(al)?$#', $host) |
|
83 | + && !preg_match('#^192\.168#', $host); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | /** |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | public static function isReallyWritable(string $file): bool |
100 | 100 | { |
101 | 101 | // If we're on a Unix server with safe_mode off we call is_writable |
102 | - if (DIRECTORY_SEPARATOR === '/' || ! ini_get('safe_mode')) { |
|
102 | + if (DIRECTORY_SEPARATOR === '/' || !ini_get('safe_mode')) { |
|
103 | 103 | return is_writable($file); |
104 | 104 | } |
105 | 105 | |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | |
119 | 119 | return true; |
120 | 120 | } |
121 | - if (! is_file($file) || ($fp = @fopen($file, 'ab')) === false) { |
|
121 | + if (!is_file($file) || ($fp = @fopen($file, 'ab')) === false) { |
|
122 | 122 | return false; |
123 | 123 | } |
124 | 124 | |
@@ -132,23 +132,23 @@ discard block |
||
132 | 132 | $path = parse_url($url); |
133 | 133 | $query = ''; |
134 | 134 | |
135 | - if (! empty($path['host'])) { |
|
135 | + if (!empty($path['host'])) { |
|
136 | 136 | $r = $path['scheme'] . '://'; |
137 | - if (! empty($path['user'])) { |
|
137 | + if (!empty($path['user'])) { |
|
138 | 138 | $r .= $path['user']; |
139 | - if (! empty($path['pass'])) { |
|
139 | + if (!empty($path['pass'])) { |
|
140 | 140 | $r .= ':' . $path['pass'] . '@'; |
141 | 141 | } |
142 | 142 | $r .= '@'; |
143 | 143 | } |
144 | - if (! empty($path['host'])) { |
|
144 | + if (!empty($path['host'])) { |
|
145 | 145 | $r .= $path['host']; |
146 | 146 | } |
147 | - if (! empty($path['port'])) { |
|
147 | + if (!empty($path['port'])) { |
|
148 | 148 | $r .= ':' . $path['port']; |
149 | 149 | } |
150 | 150 | $url = $r . $path['path']; |
151 | - if (! empty($path['query'])) { |
|
151 | + if (!empty($path['query'])) { |
|
152 | 152 | $query = '?' . $path['query']; |
153 | 153 | } |
154 | 154 | } |
@@ -172,12 +172,12 @@ discard block |
||
172 | 172 | $non_displayables = []; |
173 | 173 | |
174 | 174 | if ($url_encoded) { |
175 | - $non_displayables[] = '/%0[0-8bcef]/i'; // url encoded 00-08, 11, 12, 14, 15 |
|
176 | - $non_displayables[] = '/%1[0-9a-f]/i'; // url encoded 16-31 |
|
177 | - $non_displayables[] = '/%7f/i'; // url encoded 127 |
|
175 | + $non_displayables[] = '/%0[0-8bcef]/i'; // url encoded 00-08, 11, 12, 14, 15 |
|
176 | + $non_displayables[] = '/%1[0-9a-f]/i'; // url encoded 16-31 |
|
177 | + $non_displayables[] = '/%7f/i'; // url encoded 127 |
|
178 | 178 | } |
179 | 179 | |
180 | - $non_displayables[] = '/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]+/S'; // 00-08, 11, 12, 14-31, 127 |
|
180 | + $non_displayables[] = '/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]+/S'; // 00-08, 11, 12, 14-31, 127 |
|
181 | 181 | |
182 | 182 | do { |
183 | 183 | $str = preg_replace($non_displayables, '', $str, -1, $count); |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | return $data; |
221 | 221 | } |
222 | 222 | |
223 | - if (! in_array($context, ['html', 'js', 'css', 'url', 'attr'], true)) { |
|
223 | + if (!in_array($context, ['html', 'js', 'css', 'url', 'attr'], true)) { |
|
224 | 224 | throw new InvalidArgumentException('Invalid escape context provided.'); |
225 | 225 | } |
226 | 226 | |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | } |
232 | 232 | |
233 | 233 | static $escaper; |
234 | - if (! $escaper) { |
|
234 | + if (!$escaper) { |
|
235 | 235 | $escaper = new \Laminas\Escaper\Escaper($encoding); |
236 | 236 | } |
237 | 237 | |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | $double = true; |
298 | 298 | } |
299 | 299 | |
300 | - return htmlspecialchars($text, ENT_QUOTES | ENT_SUBSTITUTE, $charset ?: $defaultCharset, $double); |
|
300 | + return htmlspecialchars($text, ENT_QUOTES|ENT_SUBSTITUTE, $charset ?: $defaultCharset, $double); |
|
301 | 301 | } |
302 | 302 | |
303 | 303 | /** |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | { |
407 | 407 | if ($key === 'HTTPS') { |
408 | 408 | if (isset($_SERVER['HTTPS'])) { |
409 | - return ! empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off'; |
|
409 | + return !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off'; |
|
410 | 410 | } |
411 | 411 | |
412 | 412 | return strpos((string) self::env('SCRIPT_URI'), 'https://') === 0; |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | $name = (string) self::env('SCRIPT_NAME'); |
438 | 438 | $filename = (string) self::env('SCRIPT_FILENAME'); |
439 | 439 | $offset = 0; |
440 | - if (! strpos($name, '.php')) { |
|
440 | + if (!strpos($name, '.php')) { |
|
441 | 441 | $offset = 4; |
442 | 442 | } |
443 | 443 | |
@@ -462,9 +462,9 @@ discard block |
||
462 | 462 | $server_addr = $_SERVER['HTTP_HOST'] ?? ((strpos($_SERVER['SERVER_ADDR'], ':') !== false) ? '[' . $_SERVER['SERVER_ADDR'] . ']' : $_SERVER['SERVER_ADDR']); |
463 | 463 | |
464 | 464 | if ( |
465 | - (! empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off') |
|
465 | + (!empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off') |
|
466 | 466 | || (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && strtolower($_SERVER['HTTP_X_FORWARDED_PROTO']) === 'https') |
467 | - || (! empty($_SERVER['HTTP_FRONT_END_HTTPS']) && strtolower($_SERVER['HTTP_FRONT_END_HTTPS']) !== 'off') |
|
467 | + || (!empty($_SERVER['HTTP_FRONT_END_HTTPS']) && strtolower($_SERVER['HTTP_FRONT_END_HTTPS']) !== 'off') |
|
468 | 468 | ) { |
469 | 469 | $base_url = 'https'; |
470 | 470 | } else { |
@@ -512,7 +512,7 @@ discard block |
||
512 | 512 | */ |
513 | 513 | public static function deprecationWarning(string $message, int $stackFrame = 1) |
514 | 514 | { |
515 | - if (! (error_reporting() & E_USER_DEPRECATED)) { |
|
515 | + if (!(error_reporting() & E_USER_DEPRECATED)) { |
|
516 | 516 | return; |
517 | 517 | } |
518 | 518 |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | */ |
78 | 78 | public static function range($from, $to) |
79 | 79 | { |
80 | - return new static(function () use ($from, $to) { |
|
80 | + return new static(function() use ($from, $to) { |
|
81 | 81 | if ($from <= $to) { |
82 | 82 | for (; $from <= $to; $from++) { |
83 | 83 | yield $from; |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | |
126 | 126 | $cache = []; |
127 | 127 | |
128 | - return new static(function () use ($iterator, &$iteratorIndex, &$cache) { |
|
128 | + return new static(function() use ($iterator, &$iteratorIndex, &$cache) { |
|
129 | 129 | for ($index = 0; true; $index++) { |
130 | 130 | if (array_key_exists($index, $cache)) { |
131 | 131 | yield $cache[$index][0] => $cache[$index][1]; |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | $iteratorIndex++; |
140 | 140 | } |
141 | 141 | |
142 | - if (! $iterator->valid()) { |
|
142 | + if (!$iterator->valid()) { |
|
143 | 143 | break; |
144 | 144 | } |
145 | 145 | |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | */ |
180 | 180 | public function collapse() |
181 | 181 | { |
182 | - return new static(function () { |
|
182 | + return new static(function() { |
|
183 | 183 | foreach ($this as $values) { |
184 | 184 | if (is_array($values) || $values instanceof Enumerable) { |
185 | 185 | foreach ($values as $value) { |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | */ |
245 | 245 | public function doesntContain(mixed $key, ?string $operator = null, mixed $value = null): bool |
246 | 246 | { |
247 | - return ! $this->contains(...func_get_args()); |
|
247 | + return !$this->contains(...func_get_args()); |
|
248 | 248 | } |
249 | 249 | |
250 | 250 | /** |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | ? $this->identity() |
265 | 265 | : $this->valueRetriever($countBy); |
266 | 266 | |
267 | - return new static(function () use ($countBy) { |
|
267 | + return new static(function() use ($countBy) { |
|
268 | 268 | $counts = []; |
269 | 269 | |
270 | 270 | foreach ($this as $key => $value) { |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | $callback = fn ($value) => (bool) $value; |
363 | 363 | } |
364 | 364 | |
365 | - return new static(function () use ($callback) { |
|
365 | + return new static(function() use ($callback) { |
|
366 | 366 | foreach ($this as $key => $value) { |
367 | 367 | if ($callback($value, $key)) { |
368 | 368 | yield $key => $value; |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | $iterator = $this->getIterator(); |
380 | 380 | |
381 | 381 | if (null === $callback) { |
382 | - if (! $iterator->valid()) { |
|
382 | + if (!$iterator->valid()) { |
|
383 | 383 | return value($default); |
384 | 384 | } |
385 | 385 | |
@@ -400,9 +400,9 @@ discard block |
||
400 | 400 | */ |
401 | 401 | public function flatten(int $depth = INF) |
402 | 402 | { |
403 | - $instance = new static(function () use ($depth) { |
|
403 | + $instance = new static(function() use ($depth) { |
|
404 | 404 | foreach ($this as $item) { |
405 | - if (! is_array($item) && ! $item instanceof Enumerable) { |
|
405 | + if (!is_array($item) && !$item instanceof Enumerable) { |
|
406 | 406 | yield $item; |
407 | 407 | } elseif ($depth === 1) { |
408 | 408 | yield from $item; |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | */ |
421 | 421 | public function flip() |
422 | 422 | { |
423 | - return new static(function () { |
|
423 | + return new static(function() { |
|
424 | 424 | foreach ($this as $key => $value) { |
425 | 425 | yield $value => $key; |
426 | 426 | } |
@@ -458,7 +458,7 @@ discard block |
||
458 | 458 | */ |
459 | 459 | public function keyBy($keyBy) |
460 | 460 | { |
461 | - return new static(function () use ($keyBy) { |
|
461 | + return new static(function() use ($keyBy) { |
|
462 | 462 | $keyBy = $this->valueRetriever($keyBy); |
463 | 463 | |
464 | 464 | foreach ($this as $key => $item) { |
@@ -573,7 +573,7 @@ discard block |
||
573 | 573 | */ |
574 | 574 | public function isEmpty(): bool |
575 | 575 | { |
576 | - return ! $this->getIterator()->valid(); |
|
576 | + return !$this->getIterator()->valid(); |
|
577 | 577 | } |
578 | 578 | |
579 | 579 | /** |
@@ -597,7 +597,7 @@ discard block |
||
597 | 597 | */ |
598 | 598 | public function keys() |
599 | 599 | { |
600 | - return new static(function () { |
|
600 | + return new static(function() { |
|
601 | 601 | foreach ($this as $key => $value) { |
602 | 602 | yield $key; |
603 | 603 | } |
@@ -625,7 +625,7 @@ discard block |
||
625 | 625 | */ |
626 | 626 | public function pluck($value, ?string $key = null) |
627 | 627 | { |
628 | - return new static(function () use ($value, $key) { |
|
628 | + return new static(function() use ($value, $key) { |
|
629 | 629 | [$value, $key] = $this->explodePluckParameters($value, $key); |
630 | 630 | |
631 | 631 | foreach ($this as $item) { |
@@ -651,7 +651,7 @@ discard block |
||
651 | 651 | */ |
652 | 652 | public function map(callable $callback) |
653 | 653 | { |
654 | - return new static(function () use ($callback) { |
|
654 | + return new static(function() use ($callback) { |
|
655 | 655 | foreach ($this as $key => $value) { |
656 | 656 | yield $key => $callback($value, $key); |
657 | 657 | } |
@@ -671,7 +671,7 @@ discard block |
||
671 | 671 | */ |
672 | 672 | public function mapWithKeys(callable $callback) |
673 | 673 | { |
674 | - return new static(function () use ($callback) { |
|
674 | + return new static(function() use ($callback) { |
|
675 | 675 | foreach ($this as $key => $value) { |
676 | 676 | yield from $callback($value, $key); |
677 | 677 | } |
@@ -701,13 +701,13 @@ discard block |
||
701 | 701 | */ |
702 | 702 | public function combine($values) |
703 | 703 | { |
704 | - return new static(function () use ($values) { |
|
704 | + return new static(function() use ($values) { |
|
705 | 705 | $values = $this->makeIterator($values); |
706 | 706 | |
707 | 707 | $errorMessage = 'Both parameters should have an equal number of elements'; |
708 | 708 | |
709 | 709 | foreach ($this as $key) { |
710 | - if (! $values->valid()) { |
|
710 | + if (!$values->valid()) { |
|
711 | 711 | trigger_error($errorMessage, E_USER_WARNING); |
712 | 712 | |
713 | 713 | break; |
@@ -737,7 +737,7 @@ discard block |
||
737 | 737 | */ |
738 | 738 | public function nth(int $step, int $offset = 0) |
739 | 739 | { |
740 | - return new static(function () use ($step, $offset) { |
|
740 | + return new static(function() use ($step, $offset) { |
|
741 | 741 | $position = 0; |
742 | 742 | |
743 | 743 | foreach ($this->slice($offset) as $item) { |
@@ -761,7 +761,7 @@ discard block |
||
761 | 761 | $keys = is_array($keys) ? $keys : func_get_args(); |
762 | 762 | } |
763 | 763 | |
764 | - return new static(function () use ($keys) { |
|
764 | + return new static(function() use ($keys) { |
|
765 | 765 | if (null === $keys) { |
766 | 766 | yield from $this; |
767 | 767 | } else { |
@@ -787,7 +787,7 @@ discard block |
||
787 | 787 | */ |
788 | 788 | public function concat(iterable $source) |
789 | 789 | { |
790 | - return (new static(function () use ($source) { |
|
790 | + return (new static(function() use ($source) { |
|
791 | 791 | yield from $this; |
792 | 792 | |
793 | 793 | yield from $source; |
@@ -811,7 +811,7 @@ discard block |
||
811 | 811 | */ |
812 | 812 | public function replace($items) |
813 | 813 | { |
814 | - return new static(function () use ($items) { |
|
814 | + return new static(function() use ($items) { |
|
815 | 815 | $items = $this->getArrayableItems($items); |
816 | 816 | |
817 | 817 | foreach ($this as $key => $value) { |
@@ -878,7 +878,7 @@ discard block |
||
878 | 878 | */ |
879 | 879 | public function sliding(int $size = 2, int $step = 1) |
880 | 880 | { |
881 | - return new static(function () use ($size, $step) { |
|
881 | + return new static(function() use ($size, $step) { |
|
882 | 882 | $iterator = $this->getIterator(); |
883 | 883 | |
884 | 884 | $chunk = []; |
@@ -887,7 +887,7 @@ discard block |
||
887 | 887 | $chunk[$iterator->key()] = $iterator->current(); |
888 | 888 | |
889 | 889 | if (count($chunk) === $size) { |
890 | - yield (new static($chunk))->tap(function () use (&$chunk, $step) { |
|
890 | + yield (new static($chunk))->tap(function() use (&$chunk, $step) { |
|
891 | 891 | $chunk = array_slice($chunk, $step, null, true); |
892 | 892 | }); |
893 | 893 | |
@@ -913,7 +913,7 @@ discard block |
||
913 | 913 | */ |
914 | 914 | public function skip(int $count) |
915 | 915 | { |
916 | - return new static(function () use ($count) { |
|
916 | + return new static(function() use ($count) { |
|
917 | 917 | $iterator = $this->getIterator(); |
918 | 918 | |
919 | 919 | while ($iterator->valid() && $count--) { |
@@ -945,7 +945,7 @@ discard block |
||
945 | 945 | { |
946 | 946 | $callback = $this->useAsCallable($value) ? $value : $this->equality($value); |
947 | 947 | |
948 | - return new static(function () use ($callback) { |
|
948 | + return new static(function() use ($callback) { |
|
949 | 949 | $iterator = $this->getIterator(); |
950 | 950 | |
951 | 951 | while ($iterator->valid() && $callback($iterator->current(), $iterator->key())) { |
@@ -1025,7 +1025,7 @@ discard block |
||
1025 | 1025 | return static::empty(); |
1026 | 1026 | } |
1027 | 1027 | |
1028 | - return new static(function () use ($size) { |
|
1028 | + return new static(function() use ($size) { |
|
1029 | 1029 | $iterator = $this->getIterator(); |
1030 | 1030 | |
1031 | 1031 | while ($iterator->valid()) { |
@@ -1037,7 +1037,7 @@ discard block |
||
1037 | 1037 | if (count($chunk) < $size) { |
1038 | 1038 | $iterator->next(); |
1039 | 1039 | |
1040 | - if (! $iterator->valid()) { |
|
1040 | + if (!$iterator->valid()) { |
|
1041 | 1041 | break; |
1042 | 1042 | } |
1043 | 1043 | } else { |
@@ -1067,7 +1067,7 @@ discard block |
||
1067 | 1067 | */ |
1068 | 1068 | public function chunkWhile(callable $callback) |
1069 | 1069 | { |
1070 | - return new static(function () use ($callback) { |
|
1070 | + return new static(function() use ($callback) { |
|
1071 | 1071 | $iterator = $this->getIterator(); |
1072 | 1072 | |
1073 | 1073 | $chunk = new Collection(); |
@@ -1079,7 +1079,7 @@ discard block |
||
1079 | 1079 | } |
1080 | 1080 | |
1081 | 1081 | while ($iterator->valid()) { |
1082 | - if (! $callback($iterator->current(), $iterator->key(), $chunk)) { |
|
1082 | + if (!$callback($iterator->current(), $iterator->key(), $chunk)) { |
|
1083 | 1083 | yield new static($chunk); |
1084 | 1084 | |
1085 | 1085 | $chunk = new Collection(); |
@@ -1161,11 +1161,11 @@ discard block |
||
1161 | 1161 | return $this->passthru('take', func_get_args()); |
1162 | 1162 | } |
1163 | 1163 | |
1164 | - return new static(function () use ($limit) { |
|
1164 | + return new static(function() use ($limit) { |
|
1165 | 1165 | $iterator = $this->getIterator(); |
1166 | 1166 | |
1167 | 1167 | while ($limit--) { |
1168 | - if (! $iterator->valid()) { |
|
1168 | + if (!$iterator->valid()) { |
|
1169 | 1169 | break; |
1170 | 1170 | } |
1171 | 1171 | |
@@ -1186,7 +1186,7 @@ discard block |
||
1186 | 1186 | /** @var callable(mixed, int|string): bool $callback */ |
1187 | 1187 | $callback = $this->useAsCallable($value) ? $value : $this->equality($value); |
1188 | 1188 | |
1189 | - return new static(function () use ($callback) { |
|
1189 | + return new static(function() use ($callback) { |
|
1190 | 1190 | foreach ($this as $key => $item) { |
1191 | 1191 | if ($callback($item, $key)) { |
1192 | 1192 | break; |
@@ -1206,7 +1206,7 @@ discard block |
||
1206 | 1206 | { |
1207 | 1207 | $timeout = $timeout->getTimestamp(); |
1208 | 1208 | |
1209 | - return new static(function () use ($timeout) { |
|
1209 | + return new static(function() use ($timeout) { |
|
1210 | 1210 | if ($this->now() >= $timeout) { |
1211 | 1211 | return; |
1212 | 1212 | } |
@@ -1229,7 +1229,7 @@ discard block |
||
1229 | 1229 | /** @var callable(mixed, int|string): bool $callback */ |
1230 | 1230 | $callback = $this->useAsCallable($value) ? $value : $this->equality($value); |
1231 | 1231 | |
1232 | - return $this->takeUntil(fn ($item, $key) => ! $callback($item, $key)); |
|
1232 | + return $this->takeUntil(fn ($item, $key) => !$callback($item, $key)); |
|
1233 | 1233 | } |
1234 | 1234 | |
1235 | 1235 | /** |
@@ -1237,7 +1237,7 @@ discard block |
||
1237 | 1237 | */ |
1238 | 1238 | public function tapEach(callable $callback) |
1239 | 1239 | { |
1240 | - return new static(function () use ($callback) { |
|
1240 | + return new static(function() use ($callback) { |
|
1241 | 1241 | foreach ($this as $key => $value) { |
1242 | 1242 | $callback($value, $key); |
1243 | 1243 | |
@@ -1261,11 +1261,11 @@ discard block |
||
1261 | 1261 | { |
1262 | 1262 | $callback = $this->valueRetriever($key); |
1263 | 1263 | |
1264 | - return new static(function () use ($callback, $strict) { |
|
1264 | + return new static(function() use ($callback, $strict) { |
|
1265 | 1265 | $exists = []; |
1266 | 1266 | |
1267 | 1267 | foreach ($this as $key => $item) { |
1268 | - if (! in_array($id = $callback($item, $key), $exists, $strict)) { |
|
1268 | + if (!in_array($id = $callback($item, $key), $exists, $strict)) { |
|
1269 | 1269 | yield $key => $item; |
1270 | 1270 | |
1271 | 1271 | $exists[] = $id; |
@@ -1279,7 +1279,7 @@ discard block |
||
1279 | 1279 | */ |
1280 | 1280 | public function values() |
1281 | 1281 | { |
1282 | - return new static(function () { |
|
1282 | + return new static(function() { |
|
1283 | 1283 | foreach ($this as $item) { |
1284 | 1284 | yield $item; |
1285 | 1285 | } |
@@ -1293,7 +1293,7 @@ discard block |
||
1293 | 1293 | { |
1294 | 1294 | $iterables = func_get_args(); |
1295 | 1295 | |
1296 | - return new static(function () use ($iterables) { |
|
1296 | + return new static(function() use ($iterables) { |
|
1297 | 1297 | $iterators = Collection::make($iterables)->map(fn ($iterable) => $this->makeIterator($iterable))->prepend($this->getIterator()); |
1298 | 1298 | |
1299 | 1299 | while ($iterators->contains->valid()) { |
@@ -1313,7 +1313,7 @@ discard block |
||
1313 | 1313 | return $this->passthru('pad', func_get_args()); |
1314 | 1314 | } |
1315 | 1315 | |
1316 | - return new static(function () use ($size, $value) { |
|
1316 | + return new static(function() use ($size, $value) { |
|
1317 | 1317 | $yielded = 0; |
1318 | 1318 | |
1319 | 1319 | foreach ($this as $index => $item) { |
@@ -1398,7 +1398,7 @@ discard block |
||
1398 | 1398 | */ |
1399 | 1399 | protected function passthru(string $method, array $params) |
1400 | 1400 | { |
1401 | - return new static(function () use ($method, $params) { |
|
1401 | + return new static(function() use ($method, $params) { |
|
1402 | 1402 | yield from $this->collect()->{$method}(...$params); |
1403 | 1403 | }); |
1404 | 1404 | } |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | */ |
181 | 181 | public function doesntContain(mixed $key, ?string $operator = null, mixed $value = null): bool |
182 | 182 | { |
183 | - return ! $this->contains(...func_get_args()); |
|
183 | + return !$this->contains(...func_get_args()); |
|
184 | 184 | } |
185 | 185 | |
186 | 186 | /** |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | $callback = $this->valueRetriever($key); |
298 | 298 | |
299 | 299 | foreach ($this->items as $k => $v) { |
300 | - if (! $callback($v, $k)) { |
|
300 | + if (!$callback($v, $k)) { |
|
301 | 301 | return false; |
302 | 302 | } |
303 | 303 | } |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | { |
316 | 316 | if ($keys instanceof Enumerable) { |
317 | 317 | $keys = $keys->all(); |
318 | - } elseif (! is_array($keys)) { |
|
318 | + } elseif (!is_array($keys)) { |
|
319 | 319 | $keys = func_get_args(); |
320 | 320 | } |
321 | 321 | |
@@ -416,7 +416,7 @@ discard block |
||
416 | 416 | */ |
417 | 417 | public function groupBy($groupBy, $preserveKeys = false) |
418 | 418 | { |
419 | - if (! $this->useAsCallable($groupBy) && is_array($groupBy)) { |
|
419 | + if (!$this->useAsCallable($groupBy) && is_array($groupBy)) { |
|
420 | 420 | $nextGroups = $groupBy; |
421 | 421 | |
422 | 422 | $groupBy = array_shift($nextGroups); |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | foreach ($this->items as $key => $value) { |
430 | 430 | $groupKeys = $groupBy($value, $key); |
431 | 431 | |
432 | - if (! is_array($groupKeys)) { |
|
432 | + if (!is_array($groupKeys)) { |
|
433 | 433 | $groupKeys = [$groupKeys]; |
434 | 434 | } |
435 | 435 | |
@@ -440,7 +440,7 @@ discard block |
||
440 | 440 | default => $groupKey, |
441 | 441 | }; |
442 | 442 | |
443 | - if (! array_key_exists($groupKey, $results)) { |
|
443 | + if (!array_key_exists($groupKey, $results)) { |
|
444 | 444 | $results[$groupKey] = new static(); |
445 | 445 | } |
446 | 446 | |
@@ -450,7 +450,7 @@ discard block |
||
450 | 450 | |
451 | 451 | $result = new static($results); |
452 | 452 | |
453 | - if (! empty($nextGroups)) { |
|
453 | + if (!empty($nextGroups)) { |
|
454 | 454 | return $result->map->groupBy($nextGroups, $preserveKeys); |
455 | 455 | } |
456 | 456 | |
@@ -489,7 +489,7 @@ discard block |
||
489 | 489 | $keys = is_array($key) ? $key : func_get_args(); |
490 | 490 | |
491 | 491 | foreach ($keys as $value) { |
492 | - if (! $this->offsetExists($value)) { |
|
492 | + if (!$this->offsetExists($value)) { |
|
493 | 493 | return false; |
494 | 494 | } |
495 | 495 | } |
@@ -530,7 +530,7 @@ discard block |
||
530 | 530 | |
531 | 531 | $first = $this->first(); |
532 | 532 | |
533 | - if (is_array($first) || (is_object($first) && ! $first instanceof Stringable)) { |
|
533 | + if (is_array($first) || (is_object($first) && !$first instanceof Stringable)) { |
|
534 | 534 | return implode($glue ?? '', $this->pluck($value)->all()); |
535 | 535 | } |
536 | 536 | |
@@ -680,7 +680,7 @@ discard block |
||
680 | 680 | |
681 | 681 | $value = reset($pair); |
682 | 682 | |
683 | - if (! isset($dictionary[$key])) { |
|
683 | + if (!isset($dictionary[$key])) { |
|
684 | 684 | $dictionary[$key] = []; |
685 | 685 | } |
686 | 686 | |
@@ -903,7 +903,7 @@ discard block |
||
903 | 903 | */ |
904 | 904 | public function search($value, bool $strict = false) |
905 | 905 | { |
906 | - if (! $this->useAsCallable($value)) { |
|
906 | + if (!$this->useAsCallable($value)) { |
|
907 | 907 | return array_search($value, $this->items, $strict); |
908 | 908 | } |
909 | 909 | |
@@ -1137,7 +1137,7 @@ discard block |
||
1137 | 1137 | */ |
1138 | 1138 | public function sortBy($callback, int $options = SORT_REGULAR, bool $descending = false) |
1139 | 1139 | { |
1140 | - if (is_array($callback) && ! is_callable($callback)) { |
|
1140 | + if (is_array($callback) && !is_callable($callback)) { |
|
1141 | 1141 | return $this->sortByMany($callback); |
1142 | 1142 | } |
1143 | 1143 | |
@@ -1172,7 +1172,7 @@ discard block |
||
1172 | 1172 | { |
1173 | 1173 | $items = $this->items; |
1174 | 1174 | |
1175 | - uasort($items, function ($a, $b) use ($comparisons) { |
|
1175 | + uasort($items, function($a, $b) use ($comparisons) { |
|
1176 | 1176 | foreach ($comparisons as $comparison) { |
1177 | 1177 | $comparison = Arr::wrap($comparison); |
1178 | 1178 | |
@@ -1181,12 +1181,12 @@ discard block |
||
1181 | 1181 | $ascending = Arr::get($comparison, 1, true) === true |
1182 | 1182 | || Arr::get($comparison, 1, true) === 'asc'; |
1183 | 1183 | |
1184 | - if (! is_string($prop) && is_callable($prop)) { |
|
1184 | + if (!is_string($prop) && is_callable($prop)) { |
|
1185 | 1185 | $result = $prop($a, $b); |
1186 | 1186 | } else { |
1187 | 1187 | $values = [Arr::getRecursive($a, $prop), Arr::getRecursive($b, $prop)]; |
1188 | 1188 | |
1189 | - if (! $ascending) { |
|
1189 | + if (!$ascending) { |
|
1190 | 1190 | $values = array_reverse($values); |
1191 | 1191 | } |
1192 | 1192 | |
@@ -1319,7 +1319,7 @@ discard block |
||
1319 | 1319 | |
1320 | 1320 | $exists = []; |
1321 | 1321 | |
1322 | - return $this->reject(function ($item, $key) use ($callback, $strict, &$exists) { |
|
1322 | + return $this->reject(function($item, $key) use ($callback, $strict, &$exists) { |
|
1323 | 1323 | if (in_array($id = $callback($item, $key), $exists, $strict)) { |
1324 | 1324 | return true; |
1325 | 1325 | } |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | public static function check(array $data, string $path): bool |
69 | 69 | { |
70 | 70 | $results = self::extract($data, $path); |
71 | - if (! is_array($results)) { |
|
71 | + if (!is_array($results)) { |
|
72 | 72 | return false; |
73 | 73 | } |
74 | 74 | |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | foreach ($array as $values) { |
86 | 86 | if ($values instanceof Collection) { |
87 | 87 | $values = $values->all(); |
88 | - } elseif (! is_array($values)) { |
|
88 | + } elseif (!is_array($values)) { |
|
89 | 89 | continue; |
90 | 90 | } |
91 | 91 | |
@@ -126,10 +126,10 @@ discard block |
||
126 | 126 | return []; |
127 | 127 | } |
128 | 128 | |
129 | - if (! empty($valuePath) && is_array($valuePath)) { |
|
129 | + if (!empty($valuePath) && is_array($valuePath)) { |
|
130 | 130 | $format = array_shift($valuePath); |
131 | 131 | $vals = self::format($data, $valuePath, $format); |
132 | - } elseif (! empty($valuePath)) { |
|
132 | + } elseif (!empty($valuePath)) { |
|
133 | 133 | $vals = self::extract($data, $valuePath); |
134 | 134 | } |
135 | 135 | if (empty($vals)) { |
@@ -142,14 +142,14 @@ discard block |
||
142 | 142 | |
143 | 143 | if ($groupPath !== null) { |
144 | 144 | $group = self::extract($data, $groupPath); |
145 | - if (! empty($group)) { |
|
145 | + if (!empty($group)) { |
|
146 | 146 | $c = count($keys); |
147 | 147 | |
148 | 148 | for ($i = 0; $i < $c; $i++) { |
149 | - if (! isset($group[$i])) { |
|
149 | + if (!isset($group[$i])) { |
|
150 | 150 | $group[$i] = 0; |
151 | 151 | } |
152 | - if (! isset($out[$group[$i]])) { |
|
152 | + if (!isset($out[$group[$i]])) { |
|
153 | 153 | $out[$group[$i]] = []; |
154 | 154 | } |
155 | 155 | $out[$group[$i]][$keys[$i]] = $vals[$i]; |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | } |
183 | 183 | $stack = []; |
184 | 184 | |
185 | - while (! empty($needle)) { |
|
185 | + while (!empty($needle)) { |
|
186 | 186 | $key = key($needle); |
187 | 187 | $val = $needle[$key]; |
188 | 188 | unset($needle[$key]); |
@@ -191,14 +191,14 @@ discard block |
||
191 | 191 | $next = $data[$key]; |
192 | 192 | unset($data[$key]); |
193 | 193 | |
194 | - if (! empty($val)) { |
|
194 | + if (!empty($val)) { |
|
195 | 195 | $stack[] = [$val, $next]; |
196 | 196 | } |
197 | - } elseif (! array_key_exists($key, $data) || $data[$key] !== $val) { |
|
197 | + } elseif (!array_key_exists($key, $data) || $data[$key] !== $val) { |
|
198 | 198 | return false; |
199 | 199 | } |
200 | 200 | |
201 | - if (empty($needle) && ! empty($stack)) { |
|
201 | + if (empty($needle) && !empty($stack)) { |
|
202 | 202 | [$needle, $data] = array_pop($stack); |
203 | 203 | } |
204 | 204 | } |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | if ($segment === '*') { |
254 | 254 | if ($target instanceof Collection) { |
255 | 255 | $target = $target->all(); |
256 | - } elseif (! is_array($target)) { |
|
256 | + } elseif (!is_array($target)) { |
|
257 | 257 | return value($default); |
258 | 258 | } |
259 | 259 | |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | $results = []; |
328 | 328 | |
329 | 329 | foreach ($array as $key => $value) { |
330 | - if (is_array($value) && ! empty($value)) { |
|
330 | + if (is_array($value) && !empty($value)) { |
|
331 | 331 | $results = array_merge($results, static::dot($value, $prepend . $key . '.')); |
332 | 332 | } else { |
333 | 333 | $results[$prepend . $key] = $value; |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | } |
434 | 434 | |
435 | 435 | // Simple paths. |
436 | - if (! preg_match('/[{\[]/', $path)) { |
|
436 | + if (!preg_match('/[{\[]/', $path)) { |
|
437 | 437 | return (array) self::get($data, $path); |
438 | 438 | } |
439 | 439 | |
@@ -572,13 +572,13 @@ discard block |
||
572 | 572 | |
573 | 573 | reset($data); |
574 | 574 | |
575 | - while (! empty($data)) { |
|
575 | + while (!empty($data)) { |
|
576 | 576 | $key = key($data); |
577 | 577 | $element = $data[$key]; |
578 | 578 | unset($data[$key]); |
579 | 579 | |
580 | - if (is_array($element) && ! empty($element)) { |
|
581 | - if (! empty($data)) { |
|
580 | + if (is_array($element) && !empty($element)) { |
|
581 | + if (!empty($data)) { |
|
582 | 582 | $stack[] = [$data, $path]; |
583 | 583 | } |
584 | 584 | $data = $element; |
@@ -588,7 +588,7 @@ discard block |
||
588 | 588 | $result[$path . $key] = $element; |
589 | 589 | } |
590 | 590 | |
591 | - if (empty($data) && ! empty($stack)) { |
|
591 | + if (empty($data) && !empty($stack)) { |
|
592 | 592 | [$data, $path] = array_pop($stack); |
593 | 593 | reset($data); |
594 | 594 | } |
@@ -671,7 +671,7 @@ discard block |
||
671 | 671 | $extracted = []; |
672 | 672 | $count = count($paths); |
673 | 673 | |
674 | - if (! $count) { |
|
674 | + if (!$count) { |
|
675 | 675 | return; |
676 | 676 | } |
677 | 677 | |
@@ -714,7 +714,7 @@ discard block |
||
714 | 714 | */ |
715 | 715 | public static function get($data, $path, $default = null) |
716 | 716 | { |
717 | - if (! static::accessible($data)) { |
|
717 | + if (!static::accessible($data)) { |
|
718 | 718 | return $default; |
719 | 719 | } |
720 | 720 | if (is_string($path) || is_numeric($path)) { |
@@ -769,7 +769,7 @@ discard block |
||
769 | 769 | { |
770 | 770 | $keys = (array) $keys; |
771 | 771 | |
772 | - if (! $array || $keys === []) { |
|
772 | + if (!$array || $keys === []) { |
|
773 | 773 | return false; |
774 | 774 | } |
775 | 775 | |
@@ -803,7 +803,7 @@ discard block |
||
803 | 803 | |
804 | 804 | $keys = (array) $keys; |
805 | 805 | |
806 | - if (! $array) { |
|
806 | + if (!$array) { |
|
807 | 807 | return false; |
808 | 808 | } |
809 | 809 | |
@@ -855,7 +855,7 @@ discard block |
||
855 | 855 | |
856 | 856 | continue; |
857 | 857 | } |
858 | - if (! $conditions) { |
|
858 | + if (!$conditions) { |
|
859 | 859 | $data[$k] = self::insert($v, $nextPath, $values); |
860 | 860 | } |
861 | 861 | } |
@@ -883,7 +883,7 @@ discard block |
||
883 | 883 | */ |
884 | 884 | public static function isList(array $array): bool |
885 | 885 | { |
886 | - return ! self::isAssoc($array); |
|
886 | + return !self::isAssoc($array); |
|
887 | 887 | } |
888 | 888 | |
889 | 889 | /** |
@@ -983,7 +983,7 @@ discard block |
||
983 | 983 | |
984 | 984 | while (($arg = next($args)) !== false) { |
985 | 985 | foreach ((array) $arg as $key => $val) { |
986 | - if (! empty($return[$key]) && is_array($return[$key]) && is_array($val)) { |
|
986 | + if (!empty($return[$key]) && is_array($return[$key]) && is_array($val)) { |
|
987 | 987 | $return[$key] = self::merge($return[$key], $val); |
988 | 988 | } elseif (is_int($key) && isset($return[$key])) { |
989 | 989 | $return[] = $val; |
@@ -1224,7 +1224,7 @@ discard block |
||
1224 | 1224 | // If the key doesn't exist at this depth, we will just create an empty array |
1225 | 1225 | // to hold the next value, allowing us to create the arrays to hold final |
1226 | 1226 | // values at the correct depth. Then we'll keep digging into the array. |
1227 | - if (! isset($array[$key]) || ! is_array($array[$key])) { |
|
1227 | + if (!isset($array[$key]) || !is_array($array[$key])) { |
|
1228 | 1228 | $array[$key] = []; |
1229 | 1229 | } |
1230 | 1230 | |
@@ -1262,7 +1262,7 @@ discard block |
||
1262 | 1262 | $sub_key .= '.' . $key[$i]; |
1263 | 1263 | } |
1264 | 1264 | |
1265 | - if (! isset($data[$key[0]])) { |
|
1265 | + if (!isset($data[$key[0]])) { |
|
1266 | 1266 | $data[$key[0]] = []; |
1267 | 1267 | } |
1268 | 1268 | |
@@ -1306,7 +1306,7 @@ discard block |
||
1306 | 1306 | */ |
1307 | 1307 | public static function sortField(array $data, string $field, int $direction = self::SORT_ASC): array |
1308 | 1308 | { |
1309 | - usort($data, static function ($a, $b) use ($field, $direction) { |
|
1309 | + usort($data, static function($a, $b) use ($field, $direction) { |
|
1310 | 1310 | $cmp1 = self::_getSortField_($a, $field); |
1311 | 1311 | $cmp2 = self::_getSortField_($b, $field); |
1312 | 1312 | |
@@ -1451,7 +1451,7 @@ discard block |
||
1451 | 1451 | */ |
1452 | 1452 | protected static function _filter($var): bool |
1453 | 1453 | { |
1454 | - return (bool) ($var === 0 || $var === '0' || ! empty($var)); |
|
1454 | + return (bool) ($var === 0 || $var === '0' || !empty($var)); |
|
1455 | 1455 | } |
1456 | 1456 | |
1457 | 1457 | /** |
@@ -1517,11 +1517,11 @@ discard block |
||
1517 | 1517 | $val = $cond['val'] ?? null; |
1518 | 1518 | |
1519 | 1519 | // Presence test. |
1520 | - if (empty($op) && empty($val) && ! isset($data[$attr])) { |
|
1520 | + if (empty($op) && empty($val) && !isset($data[$attr])) { |
|
1521 | 1521 | return false; |
1522 | 1522 | } |
1523 | 1523 | // Empty attribute = fail. |
1524 | - if (! (isset($data[$attr]) || array_key_exists($attr, $data))) { |
|
1524 | + if (!(isset($data[$attr]) || array_key_exists($attr, $data))) { |
|
1525 | 1525 | return false; |
1526 | 1526 | } |
1527 | 1527 | $prop = null; |
@@ -1536,7 +1536,7 @@ discard block |
||
1536 | 1536 | } |
1537 | 1537 | // Pattern matches and other operators. |
1538 | 1538 | if ($op === '=' && $val && $val[0] === '/') { |
1539 | - if (! preg_match($val, $prop)) { |
|
1539 | + if (!preg_match($val, $prop)) { |
|
1540 | 1540 | return false; |
1541 | 1541 | } |
1542 | 1542 | } elseif ( |
@@ -1581,11 +1581,11 @@ discard block |
||
1581 | 1581 | |
1582 | 1582 | return $data; |
1583 | 1583 | } |
1584 | - if (! isset($_list[$key])) { |
|
1584 | + if (!isset($_list[$key])) { |
|
1585 | 1585 | $_list[$key] = []; |
1586 | 1586 | } |
1587 | 1587 | $_list = &$_list[$key]; |
1588 | - if (! is_array($_list)) { |
|
1588 | + if (!is_array($_list)) { |
|
1589 | 1589 | $_list = []; |
1590 | 1590 | } |
1591 | 1591 | } elseif ($op === 'remove') { |
@@ -1594,7 +1594,7 @@ discard block |
||
1594 | 1594 | |
1595 | 1595 | return $data; |
1596 | 1596 | } |
1597 | - if (! isset($_list[$key])) { |
|
1597 | + if (!isset($_list[$key])) { |
|
1598 | 1598 | return $data; |
1599 | 1599 | } |
1600 | 1600 | $_list = &$_list[$key]; |