@@ -119,13 +119,13 @@ discard block |
||
119 | 119 | */ |
120 | 120 | protected function factory(): BaseHandler |
121 | 121 | { |
122 | - if (! empty($this->adapter)) { |
|
122 | + if (!empty($this->adapter)) { |
|
123 | 123 | return $this->adapter; |
124 | 124 | } |
125 | 125 | |
126 | 126 | $validHandlers = $this->config['valid_handlers'] ?? self::$validHandlers; |
127 | 127 | |
128 | - if (empty($validHandlers) || ! is_array($validHandlers)) { |
|
128 | + if (empty($validHandlers) || !is_array($validHandlers)) { |
|
129 | 129 | throw new InvalidArgumentException('La configuration de la session doit avoir un tableau de $valid_handlers.'); |
130 | 130 | } |
131 | 131 | |
@@ -138,16 +138,16 @@ discard block |
||
138 | 138 | if (in_array($handler, $validHandlers, true)) { |
139 | 139 | $handler = array_search($handler, $validHandlers, true); |
140 | 140 | } |
141 | - if (! array_key_exists($handler, $validHandlers)) { |
|
141 | + if (!array_key_exists($handler, $validHandlers)) { |
|
142 | 142 | throw new InvalidArgumentException('La configuration de la session a un gestionnaire non valide spécifié.'); |
143 | 143 | } |
144 | 144 | |
145 | 145 | $adapter = new $validHandlers[$handler](); |
146 | - if (! ($adapter instanceof BaseHandler)) { |
|
146 | + if (!($adapter instanceof BaseHandler)) { |
|
147 | 147 | throw new InvalidArgumentException('Le gestionnaire de cache doit utiliser BlitzPHP\Session\Handlers\BaseHandler comme classe de base.'); |
148 | 148 | } |
149 | 149 | |
150 | - if (! $adapter->init($this->config, $this->ipAddress)) { |
|
150 | + if (!$adapter->init($this->config, $this->ipAddress)) { |
|
151 | 151 | throw new RuntimeException( |
152 | 152 | sprintf( |
153 | 153 | 'Le gestionnaire de session %s n\'est pas correctement configuré. Consultez le journal des erreurs pour plus d\'informations.', |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | */ |
183 | 183 | public function start() |
184 | 184 | { |
185 | - if (Helpers::isCli() && ! $this->onTest()) { |
|
185 | + if (Helpers::isCli() && !$this->onTest()) { |
|
186 | 186 | // @codeCoverageIgnoreStart |
187 | 187 | $this->logger->debug('Session: Initialization under CLI aborted.'); |
188 | 188 | |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | |
208 | 208 | // Désinfectez le cookie, car apparemment PHP ne le fait pas pour les gestionnaires d'espace utilisateur |
209 | 209 | if (isset($_COOKIE[$this->config['cookie_name']]) |
210 | - && (! is_string($_COOKIE[$this->config['cookie_name']]) || ! preg_match('#\A' . $this->sidRegexp . '\z#', $_COOKIE[$this->config['cookie_name']])) |
|
210 | + && (!is_string($_COOKIE[$this->config['cookie_name']]) || !preg_match('#\A' . $this->sidRegexp . '\z#', $_COOKIE[$this->config['cookie_name']])) |
|
211 | 211 | ) { |
212 | 212 | unset($_COOKIE[$this->config['cookie_name']]); |
213 | 213 | } |
@@ -215,8 +215,8 @@ discard block |
||
215 | 215 | $this->startSession(); |
216 | 216 | |
217 | 217 | // La régénération automatique de l'ID de session est-elle configurée ? (en ignorant les requêtes ajax) |
218 | - if (! Helpers::isAjaxRequest() && ($regenerateTime = $this->config['time_to_update']) > 0) { |
|
219 | - if (! isset($_SESSION['__blitz_last_regenerate'])) { |
|
218 | + if (!Helpers::isAjaxRequest() && ($regenerateTime = $this->config['time_to_update']) > 0) { |
|
219 | + if (!isset($_SESSION['__blitz_last_regenerate'])) { |
|
220 | 220 | $_SESSION['__blitz_last_regenerate'] = Date::now()->getTimestamp(); |
221 | 221 | } elseif ($_SESSION['__blitz_last_regenerate'] < (Date::now()->getTimestamp() - $regenerateTime)) { |
222 | 222 | $this->regenerate((bool) $this->config['regenerate_destroy']); |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | */ |
300 | 300 | public function get(?string $key = null) |
301 | 301 | { |
302 | - if (! empty($key) && (null !== ($value = $_SESSION[$key] ?? null) || null !== ($value = Arr::getRecursive($_SESSION ?? [], $key)))) { |
|
302 | + if (!empty($key) && (null !== ($value = $_SESSION[$key] ?? null) || null !== ($value = Arr::getRecursive($_SESSION ?? [], $key)))) { |
|
303 | 303 | return $value; |
304 | 304 | } |
305 | 305 | |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | return $key === null ? [] : null; |
308 | 308 | } |
309 | 309 | |
310 | - if (! empty($key)) { |
|
310 | + if (!empty($key)) { |
|
311 | 311 | return null; |
312 | 312 | } |
313 | 313 | |
@@ -405,14 +405,14 @@ discard block |
||
405 | 405 | { |
406 | 406 | if (isset($key)) { |
407 | 407 | return (isset($_SESSION['__blitz_vars'], $_SESSION['__blitz_vars'][$key], $_SESSION[$key]) |
408 | - && ! is_int($_SESSION['__blitz_vars'][$key])) ? $_SESSION[$key] : null; |
|
408 | + && !is_int($_SESSION['__blitz_vars'][$key])) ? $_SESSION[$key] : null; |
|
409 | 409 | } |
410 | 410 | |
411 | 411 | $flashdata = []; |
412 | 412 | |
413 | - if (! empty($_SESSION['__blitz_vars'])) { |
|
413 | + if (!empty($_SESSION['__blitz_vars'])) { |
|
414 | 414 | foreach ($_SESSION['__blitz_vars'] as $key => &$value) { |
415 | - if (! is_int($value)) { |
|
415 | + if (!is_int($value)) { |
|
416 | 416 | $flashdata[$key] = $_SESSION[$key]; |
417 | 417 | } |
418 | 418 | } |
@@ -436,7 +436,7 @@ discard block |
||
436 | 436 | { |
437 | 437 | if (is_array($key)) { |
438 | 438 | foreach ($key as $sessionKey) { |
439 | - if (! isset($_SESSION[$sessionKey])) { |
|
439 | + if (!isset($_SESSION[$sessionKey])) { |
|
440 | 440 | return false; |
441 | 441 | } |
442 | 442 | } |
@@ -448,7 +448,7 @@ discard block |
||
448 | 448 | return true; |
449 | 449 | } |
450 | 450 | |
451 | - if (! isset($_SESSION[$key])) { |
|
451 | + if (!isset($_SESSION[$key])) { |
|
452 | 452 | return false; |
453 | 453 | } |
454 | 454 | |
@@ -466,12 +466,12 @@ discard block |
||
466 | 466 | return; |
467 | 467 | } |
468 | 468 | |
469 | - if (! is_array($key)) { |
|
469 | + if (!is_array($key)) { |
|
470 | 470 | $key = [$key]; |
471 | 471 | } |
472 | 472 | |
473 | 473 | foreach ($key as $k) { |
474 | - if (isset($_SESSION['__blitz_vars'][$k]) && ! is_int($_SESSION['__blitz_vars'][$k])) { |
|
474 | + if (isset($_SESSION['__blitz_vars'][$k]) && !is_int($_SESSION['__blitz_vars'][$k])) { |
|
475 | 475 | unset($_SESSION['__blitz_vars'][$k]); |
476 | 476 | } |
477 | 477 | } |
@@ -486,14 +486,14 @@ discard block |
||
486 | 486 | */ |
487 | 487 | public function getFlashKeys(): array |
488 | 488 | { |
489 | - if (! isset($_SESSION['__blitz_vars'])) { |
|
489 | + if (!isset($_SESSION['__blitz_vars'])) { |
|
490 | 490 | return []; |
491 | 491 | } |
492 | 492 | |
493 | 493 | $keys = []; |
494 | 494 | |
495 | 495 | foreach (array_keys($_SESSION['__blitz_vars']) as $key) { |
496 | - if (! is_int($_SESSION['__blitz_vars'][$key])) { |
|
496 | + if (!is_int($_SESSION['__blitz_vars'][$key])) { |
|
497 | 497 | $keys[] = $key; |
498 | 498 | } |
499 | 499 | } |
@@ -522,7 +522,7 @@ discard block |
||
522 | 522 | |
523 | 523 | $tempdata = []; |
524 | 524 | |
525 | - if (! empty($_SESSION['__blitz_vars'])) { |
|
525 | + if (!empty($_SESSION['__blitz_vars'])) { |
|
526 | 526 | foreach ($_SESSION['__blitz_vars'] as $key => &$value) { |
527 | 527 | if (is_int($value)) { |
528 | 528 | $tempdata[$key] = $_SESSION[$key]; |
@@ -563,7 +563,7 @@ discard block |
||
563 | 563 | $v += Date::now()->getTimestamp(); |
564 | 564 | } |
565 | 565 | |
566 | - if (! array_key_exists($k, $_SESSION)) { |
|
566 | + if (!array_key_exists($k, $_SESSION)) { |
|
567 | 567 | return false; |
568 | 568 | } |
569 | 569 | |
@@ -575,7 +575,7 @@ discard block |
||
575 | 575 | return true; |
576 | 576 | } |
577 | 577 | |
578 | - if (! isset($_SESSION[$key])) { |
|
578 | + if (!isset($_SESSION[$key])) { |
|
579 | 579 | return false; |
580 | 580 | } |
581 | 581 | |
@@ -593,7 +593,7 @@ discard block |
||
593 | 593 | return; |
594 | 594 | } |
595 | 595 | |
596 | - if (! is_array($key)) { |
|
596 | + if (!is_array($key)) { |
|
597 | 597 | $key = [$key]; |
598 | 598 | } |
599 | 599 | |
@@ -613,7 +613,7 @@ discard block |
||
613 | 613 | */ |
614 | 614 | public function getTempKeys(): array |
615 | 615 | { |
616 | - if (! isset($_SESSION['__blitz_vars'])) { |
|
616 | + if (!isset($_SESSION['__blitz_vars'])) { |
|
617 | 617 | return []; |
618 | 618 | } |
619 | 619 | |
@@ -690,13 +690,13 @@ discard block |
||
690 | 690 | ini_set('session.cookie_samesite', $sameSite); |
691 | 691 | session_set_cookie_params($params); |
692 | 692 | |
693 | - if (! isset($this->config['expiration'])) { |
|
693 | + if (!isset($this->config['expiration'])) { |
|
694 | 694 | $this->config['expiration'] = (int) ini_get('session.gc_maxlifetime'); |
695 | 695 | } elseif ($this->config['expiration'] > 0) { |
696 | 696 | ini_set('session.gc_maxlifetime', (string) $this->config['expiration']); |
697 | 697 | } |
698 | 698 | |
699 | - if (! empty($this->config['savePath'])) { |
|
699 | + if (!empty($this->config['savePath'])) { |
|
700 | 700 | ini_set('session.save_path', $this->config['savePath']); |
701 | 701 | } |
702 | 702 |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | }); |
169 | 169 | |
170 | 170 | it("ToDateTimeStringWithTimeZone", function() { |
171 | - $date = Date::parse('2017-01-12 00:00', 'Europe/London'); |
|
171 | + $date = Date::parse('2017-01-12 00:00', 'Europe/London'); |
|
172 | 172 | $expect = new DateTime('2017-01-12', new DateTimeZone('Europe/London')); |
173 | 173 | |
174 | 174 | expect($expect->format('Y-m-d H:i:s'))->toBe($date->toDateTimeString()); |
@@ -178,25 +178,25 @@ discard block |
||
178 | 178 | describe("Date relatives", function() { |
179 | 179 | |
180 | 180 | it("Today", function() { |
181 | - $date = Date::today(); |
|
181 | + $date = Date::today(); |
|
182 | 182 | |
183 | 183 | expect(date('Y-m-d 00:00:00'))->toBe($date->toDateTimeString()); |
184 | 184 | }); |
185 | 185 | |
186 | 186 | it("TodayLocalized", function() { |
187 | - $date = Date::today('Europe/London'); |
|
187 | + $date = Date::today('Europe/London'); |
|
188 | 188 | |
189 | 189 | expect(date('Y-m-d 00:00:00'))->toBe($date->toDateTimeString()); |
190 | 190 | }); |
191 | 191 | |
192 | 192 | it("Yesterday", function() { |
193 | - $date = Date::yesterday(); |
|
193 | + $date = Date::yesterday(); |
|
194 | 194 | |
195 | 195 | expect(date('Y-m-d 00:00:00', strtotime('-1 day')))->toBe($date->toDateTimeString()); |
196 | 196 | }); |
197 | 197 | |
198 | 198 | it("Tomorrow", function() { |
199 | - $date = Date::tomorrow(); |
|
199 | + $date = Date::tomorrow(); |
|
200 | 200 | |
201 | 201 | expect(date('Y-m-d 00:00:00', strtotime('+1 day')))->toBe($date->toDateTimeString()); |
202 | 202 | }); |
@@ -205,19 +205,19 @@ discard block |
||
205 | 205 | describe("Creations", function() { |
206 | 206 | |
207 | 207 | it("CreateFromDate", function() { |
208 | - $date = Date::createFromDate(2017, 03, 05); |
|
208 | + $date = Date::createFromDate(2017, 03, 05); |
|
209 | 209 | |
210 | 210 | expect(date('Y-m-d 00:00:00', strtotime('2017-03-05 00:00:00')))->toBe($date->toDateTimeString()); |
211 | 211 | }); |
212 | 212 | |
213 | 213 | it("CreateFromDateLocalized", function() { |
214 | - $date = Date::createFromDate(2017, 03, 05, 'Europe/London'); |
|
214 | + $date = Date::createFromDate(2017, 03, 05, 'Europe/London'); |
|
215 | 215 | |
216 | 216 | expect(date('Y-m-d 00:00:00', strtotime('2017-03-05 00:00:00')))->toBe($date->toDateTimeString()); |
217 | 217 | }); |
218 | 218 | |
219 | 219 | it("CreateFromDateLocalized", function() { |
220 | - $date = Date::createFromTime(10, 03, 05, 'America/Chicago'); |
|
220 | + $date = Date::createFromTime(10, 03, 05, 'America/Chicago'); |
|
221 | 221 | |
222 | 222 | expect(date('Y-m-d 10:03:05'))->toBe($date->toDateTimeString()); |
223 | 223 | }); |
@@ -57,12 +57,12 @@ discard block |
||
57 | 57 | $group = on_test() ? 'test' : (on_prod() ? 'production' : 'development'); |
58 | 58 | } |
59 | 59 | |
60 | - if (! isset($config[$group])) { |
|
60 | + if (!isset($config[$group])) { |
|
61 | 61 | $group = 'default'; |
62 | 62 | } |
63 | 63 | } |
64 | 64 | |
65 | - if (is_string($group) && ! isset($config[$group]) && strpos($group, 'custom-') !== 0) { |
|
65 | + if (is_string($group) && !isset($config[$group]) && strpos($group, 'custom-') !== 0) { |
|
66 | 66 | throw new InvalidArgumentException($group . ' is not a valid database connection group.'); |
67 | 67 | } |
68 | 68 | |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | |
73 | 73 | $config = $config[$group]; |
74 | 74 | |
75 | - if (str_contains($config['driver'], 'sqlite') && $config['database'] !== ':memory:' && ! str_contains($config['database'], DS)) { |
|
75 | + if (str_contains($config['driver'], 'sqlite') && $config['database'] !== ':memory:' && !str_contains($config['database'], DS)) { |
|
76 | 76 | $config['database'] = APP_STORAGE_PATH . $config['database']; |
77 | 77 | } |
78 | 78 |
@@ -424,7 +424,7 @@ |
||
424 | 424 | $name = array_shift($arguments); |
425 | 425 | |
426 | 426 | if (empty(static::$instances[$name])) { |
427 | - if (! empty($arguments)) { |
|
427 | + if (!empty($arguments)) { |
|
428 | 428 | static::$instances[$name] = self::injector()->make($name, $arguments); |
429 | 429 | } else { |
430 | 430 | static::$instances[$name] = self::injector()->get($name); |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | $path = self::findLangFile($lang, $locale, 'php'); |
35 | 35 | if (null !== $path) { |
36 | 36 | $file_exist = true; |
37 | - if (! in_array($path, get_included_files(), true)) { |
|
37 | + if (!in_array($path, get_included_files(), true)) { |
|
38 | 38 | $languages = array_merge($languages, require($path)); |
39 | 39 | } |
40 | 40 | } |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | throw LoadException::libraryNotFound($lib); |
109 | 109 | } |
110 | 110 | |
111 | - if (true !== $file_syst && ! class_exists($lib)) { |
|
111 | + if (true !== $file_syst && !class_exists($lib)) { |
|
112 | 112 | throw LoadException::libraryDontExist($lib); |
113 | 113 | } |
114 | 114 | |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | 'preferApp' => true, |
131 | 131 | ], $options); |
132 | 132 | |
133 | - if (! preg_match('#Model$#', $model)) { |
|
133 | + if (!preg_match('#Model$#', $model)) { |
|
134 | 134 | $model .= 'Model'; |
135 | 135 | } |
136 | 136 | |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | $model = APP_NAMESPACE . '\\Models\\' . $model; |
142 | 142 | } |
143 | 143 | |
144 | - if (! class_exists($model)) { |
|
144 | + if (!class_exists($model)) { |
|
145 | 145 | throw LoadException::modelNotFound($model); |
146 | 146 | } |
147 | 147 | |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | $controller = explode('/', $controller); |
160 | 160 | |
161 | 161 | $con = ucfirst(end($controller)); |
162 | - $con = (! preg_match('#Controller$#', $con)) ? $con . 'Controller' : $con; |
|
162 | + $con = (!preg_match('#Controller$#', $con)) ? $con . 'Controller' : $con; |
|
163 | 163 | $controller[count($controller) - 1] = $con; |
164 | 164 | |
165 | 165 | foreach ($controller as $key => &$value) { |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | |
171 | 171 | $path = CONTROLLER_PATH . Helpers::ensureExt(implode(DS, $controller), 'php'); |
172 | 172 | |
173 | - if (! file_exists($path)) { |
|
173 | + if (!file_exists($path)) { |
|
174 | 174 | throw LoadException::controllerNotFound(str_replace('Controller', '', $con), $path); |
175 | 175 | } |
176 | 176 | |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | if (class_exists($class_namespaced, false)) { |
182 | 182 | return Injector::make($class_namespaced); |
183 | 183 | } |
184 | - if (! class_exists($con, false)) { |
|
184 | + if (!class_exists($con, false)) { |
|
185 | 185 | throw LoadException::controllerDontExist(str_replace('Controller', '', $con), $path); |
186 | 186 | } |
187 | 187 | |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | protected static function verifyPreferApp(array $options, string $name): bool |
211 | 211 | { |
212 | 212 | // Tout element sans restriction passe |
213 | - if (! $options['preferApp']) { |
|
213 | + if (!$options['preferApp']) { |
|
214 | 214 | return true; |
215 | 215 | } |
216 | 216 |
@@ -36,13 +36,13 @@ discard block |
||
36 | 36 | */ |
37 | 37 | public static function init() |
38 | 38 | { |
39 | - if (! class_exists('Whoops\Run')) { |
|
39 | + if (!class_exists('Whoops\Run')) { |
|
40 | 40 | return; |
41 | 41 | } |
42 | 42 | |
43 | 43 | $whoops = new Run(); |
44 | 44 | |
45 | - if (! is_online()) { |
|
45 | + if (!is_online()) { |
|
46 | 46 | if (Misc::isCommandLine()) { |
47 | 47 | $whoops->pushHandler(new PlainTextHandler()); |
48 | 48 | } elseif (Misc::isAjaxRequest()) { |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | /** |
56 | 56 | * On log toutes les erreurs |
57 | 57 | */ |
58 | - $whoops->pushHandler(static function (Throwable $exception, Inspector $inspector, RunInterface $run) { |
|
58 | + $whoops->pushHandler(static function(Throwable $exception, Inspector $inspector, RunInterface $run) { |
|
59 | 59 | /** |
60 | 60 | * @var Logger |
61 | 61 | */ |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | $this->cookies = $config['cookies']; |
258 | 258 | |
259 | 259 | if (isset($config['uri'])) { |
260 | - if (! $config['uri'] instanceof UriInterface) { |
|
260 | + if (!$config['uri'] instanceof UriInterface) { |
|
261 | 261 | throw new FrameworkException('The `uri` key must be an instance of ' . UriInterface::class); |
262 | 262 | } |
263 | 263 | $uri = $config['uri']; |
@@ -397,7 +397,7 @@ discard block |
||
397 | 397 | $ref = $this->getEnv('HTTP_REFERER'); |
398 | 398 | |
399 | 399 | $base = /* Configure::read('App.fullBaseUrl') . */ $this->webroot; |
400 | - if (! empty($ref) && ! empty($base)) { |
|
400 | + if (!empty($ref) && !empty($base)) { |
|
401 | 401 | if ($local && strpos($ref, $base) === 0) { |
402 | 402 | $ref = substr($ref, strlen($base)); |
403 | 403 | if ($ref === '' || strpos($ref, '//') === 0) { |
@@ -409,7 +409,7 @@ discard block |
||
409 | 409 | |
410 | 410 | return $ref; |
411 | 411 | } |
412 | - if (! $local) { |
|
412 | + if (!$local) { |
|
413 | 413 | return $ref; |
414 | 414 | } |
415 | 415 | } |
@@ -461,7 +461,7 @@ discard block |
||
461 | 461 | } |
462 | 462 | |
463 | 463 | $type = strtolower($type); |
464 | - if (! isset(static::$_detectors[$type])) { |
|
464 | + if (!isset(static::$_detectors[$type])) { |
|
465 | 465 | return false; |
466 | 466 | } |
467 | 467 | if ($args) { |
@@ -540,7 +540,7 @@ discard block |
||
540 | 540 | foreach ($detect['header'] as $header => $value) { |
541 | 541 | $header = $this->getEnv('http_' . $header); |
542 | 542 | if ($header !== null) { |
543 | - if (! is_string($value) && ! is_bool($value) && is_callable($value)) { |
|
543 | + if (!is_string($value) && !is_bool($value) && is_callable($value)) { |
|
544 | 544 | return $value($header); |
545 | 545 | } |
546 | 546 | |
@@ -613,7 +613,7 @@ discard block |
||
613 | 613 | public function isAll(array $types): bool |
614 | 614 | { |
615 | 615 | foreach ($types as $type) { |
616 | - if (! $this->is($type)) { |
|
616 | + if (!$this->is($type)) { |
|
617 | 617 | return false; |
618 | 618 | } |
619 | 619 | } |
@@ -716,7 +716,7 @@ discard block |
||
716 | 716 | protected function normalizeHeaderName(string $name): string |
717 | 717 | { |
718 | 718 | $name = str_replace('-', '_', strtoupper($name)); |
719 | - if (! in_array($name, ['CONTENT_LENGTH', 'CONTENT_TYPE'], true)) { |
|
719 | + if (!in_array($name, ['CONTENT_LENGTH', 'CONTENT_TYPE'], true)) { |
|
720 | 720 | $name = 'HTTP_' . $name; |
721 | 721 | } |
722 | 722 | |
@@ -899,8 +899,8 @@ discard block |
||
899 | 899 | $new = clone $this; |
900 | 900 | |
901 | 901 | if ( |
902 | - ! is_string($method) |
|
903 | - || ! preg_match('/^[!#$%&\'*+.^_`\|~0-9a-z-]+$/i', $method) |
|
902 | + !is_string($method) |
|
903 | + || !preg_match('/^[!#$%&\'*+.^_`\|~0-9a-z-]+$/i', $method) |
|
904 | 904 | ) { |
905 | 905 | throw new InvalidArgumentException(sprintf( |
906 | 906 | 'Unsupported HTTP method "%s" provided', |
@@ -1144,7 +1144,7 @@ discard block |
||
1144 | 1144 | } |
1145 | 1145 | } |
1146 | 1146 | |
1147 | - if (! isset($accept[$prefValue])) { |
|
1147 | + if (!isset($accept[$prefValue])) { |
|
1148 | 1148 | $accept[$prefValue] = []; |
1149 | 1149 | } |
1150 | 1150 | if ($prefValue) { |
@@ -1222,7 +1222,7 @@ discard block |
||
1222 | 1222 | if ($name === null) { |
1223 | 1223 | return $this->data; |
1224 | 1224 | } |
1225 | - if (! is_array($this->data) && $name) { |
|
1225 | + if (!is_array($this->data) && $name) { |
|
1226 | 1226 | return $default; |
1227 | 1227 | } |
1228 | 1228 | |
@@ -1363,7 +1363,7 @@ discard block |
||
1363 | 1363 | */ |
1364 | 1364 | public function withProtocolVersion($version): self |
1365 | 1365 | { |
1366 | - if (! preg_match('/^(1\.[01]|2(\.[0])?)$/', $version)) { |
|
1366 | + if (!preg_match('/^(1\.[01]|2(\.[0])?)$/', $version)) { |
|
1367 | 1367 | throw new InvalidArgumentException("Unsupported protocol version '{$version}' provided"); |
1368 | 1368 | } |
1369 | 1369 | $new = clone $this; |
@@ -1385,7 +1385,7 @@ discard block |
||
1385 | 1385 | public function getEnv(string $key, ?string $default = null): ?string |
1386 | 1386 | { |
1387 | 1387 | $key = strtoupper($key); |
1388 | - if (! array_key_exists($key, $this->_environment)) { |
|
1388 | + if (!array_key_exists($key, $this->_environment)) { |
|
1389 | 1389 | $this->_environment[$key] = env($key); |
1390 | 1390 | } |
1391 | 1391 | |
@@ -1597,7 +1597,7 @@ discard block |
||
1597 | 1597 | $file = Arr::get($this->uploadedFiles, $path); |
1598 | 1598 | if (is_array($file)) { |
1599 | 1599 | foreach ($file as $f) { |
1600 | - if (! ($f instanceof UploadedFile)) { |
|
1600 | + if (!($f instanceof UploadedFile)) { |
|
1601 | 1601 | return null; |
1602 | 1602 | } |
1603 | 1603 | } |
@@ -1605,7 +1605,7 @@ discard block |
||
1605 | 1605 | return $file; |
1606 | 1606 | } |
1607 | 1607 | |
1608 | - if (! ($file instanceof UploadedFileInterface)) { |
|
1608 | + if (!($file instanceof UploadedFileInterface)) { |
|
1609 | 1609 | return null; |
1610 | 1610 | } |
1611 | 1611 | |
@@ -1653,7 +1653,7 @@ discard block |
||
1653 | 1653 | continue; |
1654 | 1654 | } |
1655 | 1655 | |
1656 | - if (! $file instanceof UploadedFileInterface) { |
|
1656 | + if (!$file instanceof UploadedFileInterface) { |
|
1657 | 1657 | throw new InvalidArgumentException("Invalid file at '{$path}{$key}'"); |
1658 | 1658 | } |
1659 | 1659 | } |
@@ -1704,7 +1704,7 @@ discard block |
||
1704 | 1704 | } |
1705 | 1705 | |
1706 | 1706 | $host = $uri->getHost(); |
1707 | - if (! $host) { |
|
1707 | + if (!$host) { |
|
1708 | 1708 | return $new; |
1709 | 1709 | } |
1710 | 1710 | $port = $uri->getPort(); |
@@ -1812,7 +1812,7 @@ discard block |
||
1812 | 1812 | $validLocales = config('app.supported_locales'); |
1813 | 1813 | // S'il ne s'agit pas d'un paramètre régional valide, définissez-le |
1814 | 1814 | // aux paramètres régionaux par défaut du site. |
1815 | - if (! in_array($locale, $validLocales, true)) { |
|
1815 | + if (!in_array($locale, $validLocales, true)) { |
|
1816 | 1816 | $locale = config('app.language'); |
1817 | 1817 | } |
1818 | 1818 | |
@@ -1912,7 +1912,7 @@ discard block |
||
1912 | 1912 | $override = true; |
1913 | 1913 | } |
1914 | 1914 | |
1915 | - if ($override && ! in_array($this->_environment['REQUEST_METHOD'], ['PUT', 'POST', 'DELETE', 'PATCH'], true)) { |
|
1915 | + if ($override && !in_array($this->_environment['REQUEST_METHOD'], ['PUT', 'POST', 'DELETE', 'PATCH'], true)) { |
|
1916 | 1916 | $data = []; |
1917 | 1917 | } |
1918 | 1918 | |
@@ -1961,7 +1961,7 @@ discard block |
||
1961 | 1961 | */ |
1962 | 1962 | protected function _processFiles(array $post, array $files): array |
1963 | 1963 | { |
1964 | - if (! is_array($files)) { |
|
1964 | + if (!is_array($files)) { |
|
1965 | 1965 | return $post; |
1966 | 1966 | } |
1967 | 1967 |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | */ |
87 | 87 | public function set(string $key, mixed $value, DateInterval|int|null $ttl = null): bool |
88 | 88 | { |
89 | - if ($value === '' || ! $this->_init) { |
|
89 | + if ($value === '' || !$this->_init) { |
|
90 | 90 | return false; |
91 | 91 | } |
92 | 92 | |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | return false; |
97 | 97 | } |
98 | 98 | |
99 | - if (! empty($this->_config['serialize'])) { |
|
99 | + if (!empty($this->_config['serialize'])) { |
|
100 | 100 | $value = serialize($value); |
101 | 101 | } |
102 | 102 | |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | { |
130 | 130 | $key = $this->_key($key); |
131 | 131 | |
132 | - if (! $this->_init || $this->_setKey($key) === false) { |
|
132 | + if (!$this->_init || $this->_setKey($key) === false) { |
|
133 | 133 | return $default; |
134 | 134 | } |
135 | 135 | |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | |
167 | 167 | $data = trim($data); |
168 | 168 | |
169 | - if ($data !== '' && ! empty($this->_config['serialize'])) { |
|
169 | + if ($data !== '' && !empty($this->_config['serialize'])) { |
|
170 | 170 | $data = unserialize($data); |
171 | 171 | } |
172 | 172 | |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | { |
181 | 181 | $key = $this->_key($key); |
182 | 182 | |
183 | - if ($this->_setKey($key) === false || ! $this->_init) { |
|
183 | + if ($this->_setKey($key) === false || !$this->_init) { |
|
184 | 184 | return false; |
185 | 185 | } |
186 | 186 | |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | */ |
203 | 203 | public function clear(): bool |
204 | 204 | { |
205 | - if (! $this->_init) { |
|
205 | + if (!$this->_init) { |
|
206 | 206 | return false; |
207 | 207 | } |
208 | 208 | $this->_File = null; |
@@ -227,14 +227,14 @@ discard block |
||
227 | 227 | } |
228 | 228 | |
229 | 229 | $realPath = $fileInfo->getRealPath(); |
230 | - if (! $realPath) { |
|
230 | + if (!$realPath) { |
|
231 | 231 | unset($fileInfo); |
232 | 232 | |
233 | 233 | continue; |
234 | 234 | } |
235 | 235 | |
236 | 236 | $path = $realPath . DIRECTORY_SEPARATOR; |
237 | - if (! in_array($path, $cleared, true)) { |
|
237 | + if (!in_array($path, $cleared, true)) { |
|
238 | 238 | $this->_clearDirectory($path); |
239 | 239 | $cleared[] = $path; |
240 | 240 | } |
@@ -255,12 +255,12 @@ discard block |
||
255 | 255 | */ |
256 | 256 | protected function _clearDirectory(string $path): void |
257 | 257 | { |
258 | - if (! is_dir($path)) { |
|
258 | + if (!is_dir($path)) { |
|
259 | 259 | return; |
260 | 260 | } |
261 | 261 | |
262 | 262 | $dir = dir($path); |
263 | - if (! $dir) { |
|
263 | + if (!$dir) { |
|
264 | 264 | return; |
265 | 265 | } |
266 | 266 | |
@@ -334,13 +334,13 @@ discard block |
||
334 | 334 | } |
335 | 335 | $dir = $this->_config['path'] . $groups; |
336 | 336 | |
337 | - if (! is_dir($dir)) { |
|
337 | + if (!is_dir($dir)) { |
|
338 | 338 | mkdir($dir, 0775, true); |
339 | 339 | } |
340 | 340 | |
341 | 341 | $path = new SplFileInfo($dir . $key); |
342 | 342 | |
343 | - if (! $createKey && ! $path->isFile()) { |
|
343 | + if (!$createKey && !$path->isFile()) { |
|
344 | 344 | return false; |
345 | 345 | } |
346 | 346 | if ( |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | } |
360 | 360 | unset($path); |
361 | 361 | |
362 | - if (! $exists && ! chmod($this->_File->getPathname(), (int) $this->_config['mask'])) { |
|
362 | + if (!$exists && !chmod($this->_File->getPathname(), (int) $this->_config['mask'])) { |
|
363 | 363 | trigger_error(sprintf( |
364 | 364 | 'Impossible d\'appliquer le masque d\'autorisation "%s" sur le fichier cache "%s"', |
365 | 365 | $this->_File->getPathname(), |
@@ -379,14 +379,14 @@ discard block |
||
379 | 379 | $dir = new SplFileInfo($this->_config['path']); |
380 | 380 | $path = $dir->getPathname(); |
381 | 381 | $success = true; |
382 | - if (! is_dir($path)) { |
|
382 | + if (!is_dir($path)) { |
|
383 | 383 | // phpcs:disable |
384 | 384 | $success = @mkdir($path, 0775, true); |
385 | 385 | // phpcs:enable |
386 | 386 | } |
387 | 387 | |
388 | 388 | $isWritableDir = ($dir->isDir() && $dir->isWritable()); |
389 | - if (! $success || ($this->_init && ! $isWritableDir)) { |
|
389 | + if (!$success || ($this->_init && !$isWritableDir)) { |
|
390 | 390 | $this->_init = false; |
391 | 391 | trigger_error(sprintf( |
392 | 392 | '%s is not writable', |
@@ -430,8 +430,8 @@ discard block |
||
430 | 430 | ); |
431 | 431 | $filtered = new CallbackFilterIterator( |
432 | 432 | $contents, |
433 | - static function (SplFileInfo $current) use ($group, $prefix) { |
|
434 | - if (! $current->isFile()) { |
|
433 | + static function(SplFileInfo $current) use ($group, $prefix) { |
|
434 | + if (!$current->isFile()) { |
|
435 | 435 | return false; |
436 | 436 | } |
437 | 437 | |
@@ -492,7 +492,7 @@ discard block |
||
492 | 492 | while (false !== ($file = readdir($fp))) { |
493 | 493 | if (is_dir($sourceDir . $file) && $file[0] !== '.' && $topLevelOnly === false) { |
494 | 494 | $this->getDirFileInfo($sourceDir . $file . DIRECTORY_SEPARATOR, $topLevelOnly, true); |
495 | - } elseif (! is_dir($sourceDir . $file) && $file[0] !== '.') { |
|
495 | + } elseif (!is_dir($sourceDir . $file) && $file[0] !== '.') { |
|
496 | 496 | $_filedata[$file] = $this->getFileInfo($sourceDir . $file); |
497 | 497 | $_filedata[$file]['relative_path'] = $relativePath; |
498 | 498 | } |
@@ -518,7 +518,7 @@ discard block |
||
518 | 518 | */ |
519 | 519 | protected function getFileInfo(string $file, $returnedValues = ['name', 'server_path', 'size', 'date']) |
520 | 520 | { |
521 | - if (! is_file($file)) { |
|
521 | + if (!is_file($file)) { |
|
522 | 522 | return false; |
523 | 523 | } |
524 | 524 |
@@ -63,11 +63,11 @@ discard block |
||
63 | 63 | */ |
64 | 64 | public function init(array $config = []): bool |
65 | 65 | { |
66 | - if (! extension_loaded('redis')) { |
|
66 | + if (!extension_loaded('redis')) { |
|
67 | 67 | throw new RuntimeException('L\'extension `redis` doit être activée pour utiliser RedisHandler.'); |
68 | 68 | } |
69 | 69 | |
70 | - if (! empty($config['host'])) { |
|
70 | + if (!empty($config['host'])) { |
|
71 | 71 | $config['server'] = $config['host']; |
72 | 72 | } |
73 | 73 | |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | { |
86 | 86 | try { |
87 | 87 | $this->_Redis = new Redis(); |
88 | - if (! empty($this->_config['unix_socket'])) { |
|
88 | + if (!empty($this->_config['unix_socket'])) { |
|
89 | 89 | $return = $this->_Redis->connect($this->_config['unix_socket']); |
90 | 90 | } elseif (empty($this->_config['persistent'])) { |
91 | 91 | $return = $this->_Redis->connect( |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | |
252 | 252 | foreach ($this->_config['groups'] as $group) { |
253 | 253 | $value = $this->_Redis->get($this->_config['prefix'] . $group); |
254 | - if (! $value) { |
|
254 | + if (!$value) { |
|
255 | 255 | $value = $this->serialize(1); |
256 | 256 | $this->_Redis->set($this->_config['prefix'] . $group, $value); |
257 | 257 | } |