Passed
Pull Request — main (#15)
by
unknown
19:56 queued 15:33
created
src/Http/Redirection.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 
68 68
         // Si cela semble être une URL relative, alors convertissez-la en URL complète
69 69
         // pour une meilleure sécurité.
70
-        if (! str_starts_with($uri, 'http')) {
70
+        if (!str_starts_with($uri, 'http')) {
71 71
             $uri = site_url($uri);
72 72
         }
73 73
 
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
     {
137 137
         $request = $this->generator->getRequest();
138 138
 
139
-        $intended = $request->method() === 'GET' && ! $request->expectsJson()
139
+        $intended = $request->method() === 'GET' && !$request->expectsJson()
140 140
                         ? $this->generator->full()
141 141
                         : $this->generator->previous();
142 142
 
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
             $errors = [$key => $errors];
191 191
         }
192 192
 
193
-        if (! empty($errors)) {
193
+        if (!empty($errors)) {
194 194
             $this->session->flashErrors($errors, $key);
195 195
         }
196 196
 
Please login to merge, or discard this patch.
src/Http/Response.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
         $this->_streamMode   = $options['streamMode'] ?? $this->_streamMode;
460 460
 
461 461
         if (isset($options['stream'])) {
462
-            if (! $options['stream'] instanceof StreamInterface) {
462
+            if (!$options['stream'] instanceof StreamInterface) {
463 463
                 throw new InvalidArgumentException('Stream option must be an object that implements StreamInterface');
464 464
             }
465 465
             $this->stream = $options['stream'];
@@ -475,7 +475,7 @@  discard block
 block discarded – undo
475 475
             $this->_setStatus($options['status']);
476 476
         }
477 477
 
478
-        if (! isset($options['charset'])) {
478
+        if (!isset($options['charset'])) {
479 479
             $options['charset'] = config('app.charset');
480 480
         }
481 481
         $this->_charset = $options['charset'];
@@ -523,7 +523,7 @@  discard block
 block discarded – undo
523 523
             $charset = true;
524 524
         }
525 525
 
526
-        if ($charset && ! str_contains($type, ';')) {
526
+        if ($charset && !str_contains($type, ';')) {
527 527
             $this->_setHeader('Content-Type', "{$type}; charset={$this->_charset}");
528 528
         } else {
529 529
             $this->_setHeader('Content-Type', $type);
@@ -603,7 +603,7 @@  discard block
 block discarded – undo
603 603
     protected function _clearHeader(string $header): void
604 604
     {
605 605
         $normalized = strtolower($header);
606
-        if (! isset($this->headerNames[$normalized])) {
606
+        if (!isset($this->headerNames[$normalized])) {
607 607
             return;
608 608
         }
609 609
         $original = $this->headerNames[$normalized];
@@ -670,7 +670,7 @@  discard block
 block discarded – undo
670 670
             throw HttpException::invalidStatusCode($code);
671 671
         }
672 672
 
673
-        if (! array_key_exists($code, $this->_statusCodes) && empty($reasonPhrase)) {
673
+        if (!array_key_exists($code, $this->_statusCodes) && empty($reasonPhrase)) {
674 674
             throw HttpException::unkownStatusCode($code);
675 675
         }
676 676
 
@@ -763,7 +763,7 @@  discard block
 block discarded – undo
763 763
         if ($mapped) {
764 764
             return is_array($mapped) ? current($mapped) : $mapped;
765 765
         }
766
-        if (! str_contains($contentType, '/')) {
766
+        if (!str_contains($contentType, '/')) {
767 767
             throw new InvalidArgumentException(sprintf('`%s` est un content type invalide.', $contentType));
768 768
         }
769 769
 
@@ -846,7 +846,7 @@  discard block
 block discarded – undo
846 846
      */
847 847
     public function withCache($since, $time = '+1 day'): static
848 848
     {
849
-        if (! is_int($time)) {
849
+        if (!is_int($time)) {
850 850
             $time = strtotime($time);
851 851
             if ($time === false) {
852 852
                 throw new InvalidArgumentException(
@@ -1314,7 +1314,7 @@  discard block
 block discarded – undo
1314 1314
      */
1315 1315
     public function getCookie(string $name): ?array
1316 1316
     {
1317
-        if (! $this->hasCookie($name)) {
1317
+        if (!$this->hasCookie($name)) {
1318 1318
             return null;
1319 1319
         }
1320 1320
 
@@ -1326,7 +1326,7 @@  discard block
 block discarded – undo
1326 1326
      */
1327 1327
     public function hasCookie(string $name, ?string $value = null): bool
1328 1328
     {
1329
-        if (! $this->_cookies->has($name)) {
1329
+        if (!$this->_cookies->has($name)) {
1330 1330
             return false;
1331 1331
         }
1332 1332
 
@@ -1403,7 +1403,7 @@  discard block
 block discarded – undo
1403 1403
 
1404 1404
         $extension = strtolower($file->getExtension());
1405 1405
         $mapped    = $this->getMimeType($extension);
1406
-        if ((! $extension || ! $mapped) && $options['download'] === null) {
1406
+        if ((!$extension || !$mapped) && $options['download'] === null) {
1407 1407
             $options['download'] = true;
1408 1408
         }
1409 1409
 
@@ -1465,12 +1465,12 @@  discard block
 block discarded – undo
1465 1465
         if (str_contains($path, '../') || str_contains($path, '..\\')) {
1466 1466
             throw new LoadException('The requested file contains `..` and will not be read.');
1467 1467
         }
1468
-        if (! is_file($path)) {
1468
+        if (!is_file($path)) {
1469 1469
             $path = APP_PATH . $path;
1470 1470
         }
1471 1471
 
1472 1472
         $file = new SplFileInfo($path);
1473
-        if (! $file->isFile() || ! $file->isReadable()) {
1473
+        if (!$file->isFile() || !$file->isReadable()) {
1474 1474
             if (on_dev()) {
1475 1475
                 throw new LoadException(sprintf('The requested file %s was not found or not readable', $path));
1476 1476
             }
Please login to merge, or discard this patch.
src/Http/MiddlewareQueue.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
      */
252 252
     public function seek(int $position): void
253 253
     {
254
-        if (! isset($this->queue[$position])) {
254
+        if (!isset($this->queue[$position])) {
255 255
             throw new OutOfBoundsException(sprintf('Invalid seek position (%s).', $position));
256 256
         }
257 257
 
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
      */
272 272
     public function current(): MiddlewareInterface
273 273
     {
274
-        if (! isset($this->queue[$this->position])) {
274
+        if (!isset($this->queue[$this->position])) {
275 275
             throw new OutOfBoundsException(sprintf('Position actuelle non valide (%s).', $this->position));
276 276
         }
277 277
 
@@ -343,8 +343,8 @@  discard block
 block discarded – undo
343 343
     public function resolveGroups()
344 344
     {
345 345
         foreach ($this->queue as $queue) {
346
-            if (is_string($queue) && ! empty($this->groups[$queue])) {
347
-                if (! is_array($this->groups[$queue])) {
346
+            if (is_string($queue) && !empty($this->groups[$queue])) {
347
+                if (!is_array($this->groups[$queue])) {
348 348
                     continue;
349 349
                 }
350 350
 
Please login to merge, or discard this patch.
src/Router/Dispatcher.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
             $controller = $routes->getDefaultController();
178 178
         }
179 179
 
180
-        if (! $fullName && is_string($controller)) {
180
+        if (!$fullName && is_string($controller)) {
181 181
             $controller = str_replace($routes->getDefaultNamespace(), '', $controller);
182 182
         }
183 183
 
@@ -300,14 +300,14 @@  discard block
 block discarded – undo
300 300
             return;
301 301
         }
302 302
 
303
-        if (is_cli() && ! on_test()) {
303
+        if (is_cli() && !on_test()) {
304 304
             // @codeCoverageIgnoreStart
305 305
             // $this->request = Services::clirequest($this->config);
306 306
             // @codeCoverageIgnoreEnd
307 307
         }
308 308
 
309 309
         $version = $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.1';
310
-        if (! is_numeric($version)) {
310
+        if (!is_numeric($version)) {
311 311
             $version = substr($version, strpos($version, '/') + 1);
312 312
         }
313 313
 
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
         // Supposons le succès jusqu'à preuve du contraire.
327 327
         $this->response = Services::response()->withStatus(200);
328 328
 
329
-        if (! is_cli() || on_test()) {
329
+        if (!is_cli() || on_test()) {
330 330
         }
331 331
 
332 332
         $this->response = $this->response->withProtocolVersion($this->request->getProtocolVersion());
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
         }
411 411
 
412 412
         // Essayez de charger automatiquement la classe
413
-        if (! class_exists($this->controller, true) || ($this->method[0] === '_' && $this->method !== '__invoke')) {
413
+        if (!class_exists($this->controller, true) || ($this->method[0] === '_' && $this->method !== '__invoke')) {
414 414
             throw PageNotFoundException::controllerNotFound($this->controller, $this->method);
415 415
         }
416 416
 
@@ -501,7 +501,7 @@  discard block
 block discarded – undo
501 501
 
502 502
         $this->outputBufferingEnd();
503 503
 
504
-        throw PageNotFoundException::pageNotFound(! on_prod() || is_cli() ? $e->getMessage() : '');
504
+        throw PageNotFoundException::pageNotFound(!on_prod() || is_cli() ? $e->getMessage() : '');
505 505
     }
506 506
 
507 507
     /**
@@ -543,7 +543,7 @@  discard block
 block discarded – undo
543 543
     public function storePreviousURL($uri)
544 544
     {
545 545
         // Ignorer les requêtes CLI
546
-        if (is_cli() && ! on_test()) {
546
+        if (is_cli() && !on_test()) {
547 547
             return; // @codeCoverageIgnore
548 548
         }
549 549
 
@@ -553,7 +553,7 @@  discard block
 block discarded – undo
553 553
         }
554 554
 
555 555
         // Ignorer les reponses non-HTML
556
-        if (! str_contains($this->response->getHeaderLine('Content-Type'), 'text/html')) {
556
+        if (!str_contains($this->response->getHeaderLine('Content-Type'), 'text/html')) {
557 557
             return;
558 558
         }
559 559
 
@@ -577,7 +577,7 @@  discard block
 block discarded – undo
577 577
      */
578 578
     protected function sendResponse()
579 579
     {
580
-        if (! $this->isAjaxRequest()) {
580
+        if (!$this->isAjaxRequest()) {
581 581
             $this->response = Services::toolbar()->prepare(
582 582
                 $this->getPerformanceStats(),
583 583
                 $this->request,
@@ -670,11 +670,11 @@  discard block
 block discarded – undo
670 670
      */
671 671
     private function spoofRequestMethod(): callable
672 672
     {
673
-        return static function (ServerRequestInterface $request, ResponseInterface $response, callable $next) {
673
+        return static function(ServerRequestInterface $request, ResponseInterface $response, callable $next) {
674 674
             $post = $request->getParsedBody();
675 675
 
676 676
             // Ne fonctionne qu'avec les formulaires POST
677
-            if ($request->getMethod() === Method::POST && ! empty($post['_method'])) {
677
+            if ($request->getMethod() === Method::POST && !empty($post['_method'])) {
678 678
                 // Accepte seulement PUT, PATCH, DELETE
679 679
                 if (in_array($post['_method'], [Method::PUT, Method::PATCH, Method::DELETE], true)) {
680 680
                     $request = $request->withMethod($post['_method']);
@@ -687,7 +687,7 @@  discard block
 block discarded – undo
687 687
 
688 688
     private function bootApp(): callable
689 689
     {
690
-        return function (ServerRequestInterface $request, ResponseInterface $response, callable $next): ResponseInterface {
690
+        return function(ServerRequestInterface $request, ResponseInterface $response, callable $next): ResponseInterface {
691 691
             Services::set(Request::class, $request);
692 692
             Services::set(Response::class, $response);
693 693
 
@@ -695,10 +695,10 @@  discard block
 block discarded – undo
695 695
                 $returned = $this->startController();
696 696
 
697 697
                 // Les controleur sous forme de Closure sont executes dans startController().
698
-                if (! is_callable($this->controller)) {
698
+                if (!is_callable($this->controller)) {
699 699
                     $controller = $this->createController($request, $response);
700 700
 
701
-                    if (! method_exists($controller, '_remap') && ! is_callable([$controller, $this->method], false)) {
701
+                    if (!method_exists($controller, '_remap') && !is_callable([$controller, $this->method], false)) {
702 702
                         throw PageNotFoundException::methodNotFound($this->method);
703 703
                     }
704 704
 
Please login to merge, or discard this patch.
src/Router/AutoRouter.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
             $class = $this->translateURIDashes(ucfirst($segment));
162 162
 
163 163
             // dès que nous rencontrons un segment qui n'est pas compatible PSR-4, arrêter la recherche
164
-            if (! $this->isValidSegment($class)) {
164
+            if (!$this->isValidSegment($class)) {
165 165
                 return false;
166 166
             }
167 167
 
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
             throw new MethodNotFoundException();
388 388
         }
389 389
 
390
-        if (! $refMethod->isPublic()) {
390
+        if (!$refMethod->isPublic()) {
391 391
             throw new MethodNotFoundException();
392 392
         }
393 393
 
@@ -449,7 +449,7 @@  discard block
 block discarded – undo
449 449
             return;
450 450
         }
451 451
 
452
-        if (! in_array(ltrim($classname, '\\'), get_declared_classes(), true)) {
452
+        if (!in_array(ltrim($classname, '\\'), get_declared_classes(), true)) {
453 453
             throw new PageNotFoundException(
454 454
                 '"' . $classname . '" n\'a pas été trouvé.'
455 455
             );
@@ -468,7 +468,7 @@  discard block
 block discarded – undo
468 468
             return;
469 469
         }
470 470
 
471
-        if (! in_array($method, get_class_methods($this->controller), true)) {
471
+        if (!in_array($method, get_class_methods($this->controller), true)) {
472 472
             throw new PageNotFoundException(
473 473
                 '"' . $this->controller . '::' . $method . '()" n\'a pas été trouvé.'
474 474
             );
@@ -572,7 +572,7 @@  discard block
 block discarded – undo
572 572
      */
573 573
     public function directory(): string
574 574
     {
575
-        return ! empty($this->directory) ? $this->directory : '';
575
+        return !empty($this->directory) ? $this->directory : '';
576 576
     }
577 577
 
578 578
     /**
Please login to merge, or discard this patch.
src/Router/Router.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
         // Toujours là ? Ensuite, nous pouvons essayer de faire correspondre l'URI avec
176 176
         // Contrôleurs/répertoires, mais l'application peut ne pas
177 177
         // vouloir ceci, comme dans le cas des API.
178
-        if (! $this->collection->shouldAutoRoute()) {
178
+        if (!$this->collection->shouldAutoRoute()) {
179 179
             throw new PageNotFoundException("Impossible de trouver une route pour '{$this->collection->getHTTPVerb()}: {$uri}'.");
180 180
         }
181 181
 
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
      */
206 206
     public function controllerName()
207 207
     {
208
-        if (! is_string($this->controller)) {
208
+        if (!is_string($this->controller)) {
209 209
             return $this->controller;
210 210
         }
211 211
 
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
 
251 251
             return [
252 252
                 $routeArray[0], // Controller
253
-                $routeArray[1] ?? 'index',   // Method
253
+                $routeArray[1] ?? 'index', // Method
254 254
             ];
255 255
         }
256 256
 
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
                 // Cette route est-elle censée rediriger vers une autre ?
375 375
                 if ($this->collection->isRedirect($routeKey)) {
376 376
                     // remplacement des groupes de routes correspondants par des références : post/([0-9]+) -> post/$1
377
-                    $redirectTo = preg_replace_callback('/(\([^\(]+\))/', static function () {
377
+                    $redirectTo = preg_replace_callback('/(\([^\(]+\))/', static function() {
378 378
                         static $i = 1;
379 379
 
380 380
                         return '$' . $i++;
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
                     );
395 395
 
396 396
                     if ($this->collection->shouldUseSupportedLocalesOnly()
397
-                        && ! in_array($matched['locale'], config('app.supported_locales'), true)) {
397
+                        && !in_array($matched['locale'], config('app.supported_locales'), true)) {
398 398
                         // Lancer une exception pour empêcher l'autorouteur,
399 399
                         // si activé, essayer de trouver une route
400 400
                         throw PageNotFoundException::localeNotSupported($matched['locale']);
@@ -406,7 +406,7 @@  discard block
 block discarded – undo
406 406
 
407 407
                 // Utilisons-nous Closures ? Si tel est le cas, nous devons collecter les paramètres dans un tableau
408 408
                 // afin qu'ils puissent être transmis ultérieurement à la méthode du contrôleur.
409
-                if (! is_string($handler) && is_callable($handler)) {
409
+                if (!is_string($handler) && is_callable($handler)) {
410 410
                     $this->controller = $handler;
411 411
 
412 412
                     // Supprime la chaîne d'origine du tableau matches
@@ -483,7 +483,7 @@  discard block
 block discarded – undo
483 483
 
484 484
         return preg_replace_callback(
485 485
             $pattern,
486
-            static function ($match) use ($matches) {
486
+            static function($match) use ($matches) {
487 487
                 $index = (int) $match[1];
488 488
 
489 489
                 return $matches[$index] ?? '';
@@ -523,7 +523,7 @@  discard block
 block discarded – undo
523 523
 
524 524
         // $this->method contient déjà le nom de la méthode par défaut,
525 525
         // donc ne l'écrasez pas avec le vide.
526
-        if (! empty($method)) {
526
+        if (!empty($method)) {
527 527
             $this->setMethod($method);
528 528
         }
529 529
 
Please login to merge, or discard this patch.
src/Router/RouteCollection.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
         // Incluez le fichier routesFile s'il n'existe pas.
259 259
         // Ne conserver que pour les fins BC pour l'instant.
260 260
         $routeFiles = $this->routeFiles;
261
-        if (! in_array($routesFile, $routeFiles, true)) {
261
+        if (!in_array($routesFile, $routeFiles, true)) {
262 262
             $routeFiles[] = $routesFile;
263 263
         }
264 264
 
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
         $routes = $this;
267 267
 
268 268
         foreach ($routeFiles as $routesFile) {
269
-            if (! is_file($routesFile)) {
269
+            if (!is_file($routesFile)) {
270 270
                 logger()->warning(sprintf('Fichier de route introuvable : "%s"', $routesFile));
271 271
 
272 272
                 continue;
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
      */
316 316
     public function placeholder(array|string $placeholder, ?string $pattern = null): self
317 317
     {
318
-        if (! is_array($placeholder)) {
318
+        if (!is_array($placeholder)) {
319 319
             $placeholder = [$placeholder => $pattern];
320 320
         }
321 321
 
@@ -1031,7 +1031,7 @@  discard block
 block discarded – undo
1031 1031
      *
1032 1032
      * @param array|(Closure(mixed...): (ResponseInterface|string|void))|string $to
1033 1033
      */
1034
-    public function match(array $verbs = [], string $from = '', $to = '', ?array $options = null): self
1034
+    public function match(array $verbs = [], string $from = '', $to = '', ?array $options = null) : self
1035 1035
     {
1036 1036
         if (empty($from) || empty($to)) {
1037 1037
             throw new InvalidArgumentException('Vous devez fournir les paramètres : $from, $to.');
@@ -1222,7 +1222,7 @@  discard block
 block discarded – undo
1222 1222
                 $from = $route['from'];
1223 1223
 
1224 1224
                 // on ignore les closures
1225
-                if (! is_string($to)) {
1225
+                if (!is_string($to)) {
1226 1226
                     continue;
1227 1227
                 }
1228 1228
 
@@ -1233,7 +1233,7 @@  discard block
 block discarded – undo
1233 1233
 
1234 1234
                 // S'il y a une chance de correspondance, alors ce sera
1235 1235
                 // soit avec $search au début de la chaîne $to.
1236
-                if (! str_starts_with($to, $search)) {
1236
+                if (!str_starts_with($to, $search)) {
1237 1237
                     continue;
1238 1238
                 }
1239 1239
 
@@ -1309,7 +1309,7 @@  discard block
 block discarded – undo
1309 1309
 
1310 1310
         // Construisez notre chaîne résultante, en insérant les $params aux endroits appropriés.
1311 1311
         foreach ($matches[0] as $index => $placeholder) {
1312
-            if (! isset($params[$index])) {
1312
+            if (!isset($params[$index])) {
1313 1313
                 throw new InvalidArgumentException(
1314 1314
                     'Argument manquant pour "' . $placeholder . '" dans la route "' . $from . '".'
1315 1315
                 );
@@ -1320,7 +1320,7 @@  discard block
 block discarded – undo
1320 1320
             // ou peut-être que $placeholder n'est pas un espace réservé, mais une regex.
1321 1321
             $pattern = $this->placeholders[$placeholderName] ?? $placeholder;
1322 1322
 
1323
-            if (! preg_match('#^' . $pattern . '$#u', (string) $params[$index])) {
1323
+            if (!preg_match('#^' . $pattern . '$#u', (string) $params[$index])) {
1324 1324
                 throw RouterException::invalidParameterType();
1325 1325
             }
1326 1326
 
@@ -1377,7 +1377,7 @@  discard block
 block discarded – undo
1377 1377
             $from = trim($from, '/');
1378 1378
         }
1379 1379
 
1380
-        if (is_string($to) && ! str_contains($to, '::') && class_exists($to) && method_exists($to, '__invoke')) {
1380
+        if (is_string($to) && !str_contains($to, '::') && class_exists($to) && method_exists($to, '__invoke')) {
1381 1381
             $to = [$to, '__invoke'];
1382 1382
         }
1383 1383
 
@@ -1389,7 +1389,7 @@  discard block
 block discarded – undo
1389 1389
         $options = array_merge($this->currentOptions ?? [], $options ?? []);
1390 1390
 
1391 1391
         if (isset($options['middleware'])) {
1392
-            if (! isset($options['middlewares'])) {
1392
+            if (!isset($options['middlewares'])) {
1393 1393
                 $options['middlewares'] = (array) $options['middleware'];
1394 1394
             }
1395 1395
             unset($options['middleware']);
@@ -1410,9 +1410,9 @@  discard block
 block discarded – undo
1410 1410
         }
1411 1411
 
1412 1412
         // Limitation du nom d'hôte ?
1413
-        if (! empty($options['hostname'])) {
1413
+        if (!empty($options['hostname'])) {
1414 1414
             // @todo déterminer s'il existe un moyen de mettre les hôtes sur liste blanche ?
1415
-            if (! $this->checkHostname($options['hostname'])) {
1415
+            if (!$this->checkHostname($options['hostname'])) {
1416 1416
                 return;
1417 1417
             }
1418 1418
 
@@ -1420,10 +1420,10 @@  discard block
 block discarded – undo
1420 1420
         }
1421 1421
 
1422 1422
         // Limitation du nom sous-domaine ?
1423
-        elseif (! empty($options['subdomain'])) {
1423
+        elseif (!empty($options['subdomain'])) {
1424 1424
             // Si nous ne correspondons pas au sous-domaine actuel, alors
1425 1425
             // nous n'avons pas besoin d'ajouter la route.
1426
-            if (! $this->checkSubdomains($options['subdomain'])) {
1426
+            if (!$this->checkSubdomains($options['subdomain'])) {
1427 1427
                 return;
1428 1428
             }
1429 1429
 
@@ -1456,9 +1456,9 @@  discard block
 block discarded – undo
1456 1456
         }
1457 1457
 
1458 1458
         // S'il s'agit d'une redirection, aucun traitement
1459
-        if (! isset($options['redirect']) && is_string($to)) {
1459
+        if (!isset($options['redirect']) && is_string($to)) {
1460 1460
             // Si aucun espace de noms n'est trouvé, ajouter l'espace de noms par défaut
1461
-            if (! str_contains($to, '\\') || strpos($to, '\\') > 0) {
1461
+            if (!str_contains($to, '\\') || strpos($to, '\\') > 0) {
1462 1462
                 $namespace = $options['namespace'] ?? $this->defaultNamespace;
1463 1463
                 $to        = trim($namespace, '\\') . '\\' . $to;
1464 1464
             }
@@ -1475,7 +1475,7 @@  discard block
 block discarded – undo
1475 1475
         // cela ne fonctionne que parce que les routes découvertes sont ajoutées juste avant
1476 1476
         // pour tenter de router la requête.
1477 1477
         $routeKeyExists = isset($this->routes[$verb][$routeKey]);
1478
-        if ((isset($this->routesNames[$verb][$name]) || $routeKeyExists) && ! $overwrite) {
1478
+        if ((isset($this->routesNames[$verb][$name]) || $routeKeyExists) && !$overwrite) {
1479 1479
             return;
1480 1480
         }
1481 1481
 
@@ -1501,7 +1501,7 @@  discard block
 block discarded – undo
1501 1501
     private function checkHostname(string $hostname): bool
1502 1502
     {
1503 1503
         // Les appels CLI ne peuvent pas être sur le nom d'hôte.
1504
-        if (! isset($this->httpHost)) {
1504
+        if (!isset($this->httpHost)) {
1505 1505
             return false;
1506 1506
         }
1507 1507
 
@@ -1517,7 +1517,7 @@  discard block
 block discarded – undo
1517 1517
     private function checkSubdomains($subdomains): bool
1518 1518
     {
1519 1519
         // Les appels CLI ne peuvent pas être sur le sous-domaine.
1520
-        if (! isset($this->httpHost)) {
1520
+        if (!isset($this->httpHost)) {
1521 1521
             return false;
1522 1522
         }
1523 1523
 
@@ -1525,13 +1525,13 @@  discard block
 block discarded – undo
1525 1525
             $this->currentSubdomain = $this->determineCurrentSubdomain();
1526 1526
         }
1527 1527
 
1528
-        if (! is_array($subdomains)) {
1528
+        if (!is_array($subdomains)) {
1529 1529
             $subdomains = [$subdomains];
1530 1530
         }
1531 1531
 
1532 1532
         // Les routes peuvent être limitées à n'importe quel sous-domaine. Dans ce cas, cependant,
1533 1533
         // il nécessite la présence d'un sous-domaine.
1534
-        if (! empty($this->currentSubdomain) && in_array('*', $subdomains, true)) {
1534
+        if (!empty($this->currentSubdomain) && in_array('*', $subdomains, true)) {
1535 1535
             return true;
1536 1536
         }
1537 1537
 
@@ -1553,7 +1553,7 @@  discard block
 block discarded – undo
1553 1553
         // sur l'URL sinon parse_url sera mal interprété
1554 1554
         // 'hôte' comme 'chemin'.
1555 1555
         $url = $this->httpHost;
1556
-        if (! str_starts_with($url, 'http')) {
1556
+        if (!str_starts_with($url, 'http')) {
1557 1557
             $url = 'http://' . $url;
1558 1558
         }
1559 1559
 
@@ -1597,7 +1597,7 @@  discard block
 block discarded – undo
1597 1597
      */
1598 1598
     private function getControllerName(Closure|string $handler): ?string
1599 1599
     {
1600
-        if (! is_string($handler)) {
1600
+        if (!is_string($handler)) {
1601 1601
             return null;
1602 1602
         }
1603 1603
 
@@ -1656,13 +1656,13 @@  discard block
 block discarded – undo
1656 1656
      */
1657 1657
     private function replaceLocale(string $route, ?string $locale = null): string
1658 1658
     {
1659
-        if (! str_contains($route, '{locale}')) {
1659
+        if (!str_contains($route, '{locale}')) {
1660 1660
             return $route;
1661 1661
         }
1662 1662
 
1663 1663
         // Vérifier les paramètres régionaux non valides
1664 1664
         if ($locale !== null) {
1665
-            if (! in_array($locale, config('app.supported_locales'), true)) {
1665
+            if (!in_array($locale, config('app.supported_locales'), true)) {
1666 1666
                 $locale = null;
1667 1667
             }
1668 1668
         }
Please login to merge, or discard this patch.
src/Cli/Console/Command.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
      */
305 305
     final public function success(string $message, bool $badge = true, string $label = 'SUCCESS'): self
306 306
     {
307
-        if (! $badge) {
307
+        if (!$badge) {
308 308
             $this->writer->okBold($label);
309 309
         } else {
310 310
             $this->writer->boldWhiteBgGreen(" {$label} ");
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
      */
319 319
     final public function warning(string $message, bool $badge = true, string $label = 'WARNING'): self
320 320
     {
321
-        if (! $badge) {
321
+        if (!$badge) {
322 322
             $this->writer->warnBold($label);
323 323
         } else {
324 324
             $this->writer->boldWhiteBgYellow(" {$label} ");
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
      */
333 333
     final public function info(string $message, bool $badge = true, string $label = 'INFO'): self
334 334
     {
335
-        if (! $badge) {
335
+        if (!$badge) {
336 336
             $this->writer->infoBold($label);
337 337
         } else {
338 338
             $this->writer->boldWhiteBgCyan(" {$label} ");
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
      */
347 347
     final public function error(string $message, bool $badge = true, string $label = 'ERROR'): self
348 348
     {
349
-        if (! $badge) {
349
+        if (!$badge) {
350 350
             $this->writer->errorBold($label);
351 351
         } else {
352 352
             $this->writer->boldWhiteBgRed(" {$label} ");
@@ -449,7 +449,7 @@  discard block
 block discarded – undo
449 449
      */
450 450
     final public function json($data): self
451 451
     {
452
-        $this->write(json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES), true);
452
+        $this->write(json_encode($data, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES), true);
453 453
 
454 454
         return $this;
455 455
     }
Please login to merge, or discard this patch.
src/Cli/Console/Console.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 
158 158
         foreach ($options as $key => $value) {
159 159
             $key = preg_replace('/^\-\-/', '', $key);
160
-            if (! isset($options[$key])) {
160
+            if (!isset($options[$key])) {
161 161
                 $options[$key] = $value;
162 162
             }
163 163
         }
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
      */
171 171
     public function commandExists(string $commandName): bool
172 172
     {
173
-        return ! empty($this->_commands[$commandName]);
173
+        return !empty($this->_commands[$commandName]);
174 174
     }
175 175
 
176 176
     /**
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
         foreach ($files as $file) {
206 206
             $className = $locator->findQualifiedNameFromPath($file);
207 207
 
208
-            if ($className === false || ! class_exists($className)) {
208
+            if ($className === false || !class_exists($className)) {
209 209
                 continue;
210 210
             }
211 211
 
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
         $class  = new ReflectionClass($className);
232 232
         $logger = $logger ?: Services::logger();
233 233
 
234
-        if (! $class->isInstantiable() || ! $class->isSubclassOf(Command::class)) {
234
+        if (!$class->isInstantiable() || !$class->isSubclassOf(Command::class)) {
235 235
             throw CLIException::invalidCommand($className);
236 236
         }
237 237
 
@@ -258,13 +258,13 @@  discard block
 block discarded – undo
258 258
             $value = (array) $value;
259 259
 
260 260
             $description = $value[0];
261
-            if (! is_string($description)) {
261
+            if (!is_string($description)) {
262 262
                 continue;
263 263
             }
264 264
 
265 265
             $default = $value[1] ?? null;
266 266
             $filter  = $value[2] ?? null;
267
-            if ($filter !== null && ! is_callable($filter)) {
267
+            if ($filter !== null && !is_callable($filter)) {
268 268
                 $filter = null;
269 269
             }
270 270
 
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
             $value = (array) $value;
277 277
 
278 278
             $description = $value[0];
279
-            if (! is_string($description)) {
279
+            if (!is_string($description)) {
280 280
                 continue;
281 281
             }
282 282
 
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
         }
287 287
 
288 288
         $console = $this;
289
-        $action  = function (?array $arguments = [], ?array $options = [], ?bool $suppress = null) use ($instance, $command, $console) {
289
+        $action  = function(?array $arguments = [], ?array $options = [], ?bool $suppress = null) use ($instance, $command, $console) {
290 290
             foreach ($instance->required as $package) {
291 291
                 $package = explode(':', $package);
292 292
                 $version = $package[1] ?? null;
@@ -295,9 +295,9 @@  discard block
 block discarded – undo
295 295
                 /** @var \Ahc\Cli\IO\Interactor $io */
296 296
                 $io = $this->io();
297 297
 
298
-                if (! InstalledVersions::isInstalled($package)) {
298
+                if (!InstalledVersions::isInstalled($package)) {
299 299
                     $io->info('Cette commande nécessite le package "' . $package . '" mais vous ne l\'avez pas', true);
300
-                    if (! $io->confirm('Voulez-vous l\'installer maintenant ?')) {
300
+                    if (!$io->confirm('Voulez-vous l\'installer maintenant ?')) {
301 301
                         return;
302 302
                     }
303 303
 
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
             }
314 314
 
315 315
             $suppress = $suppress ?: $console->suppress;
316
-            if (! $suppress) {
316
+            if (!$suppress) {
317 317
                 $console->start($instance);
318 318
             }
319 319
 
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
 
329 329
             $result = $instance->setOptions($options)->setArguments($arguments)->execute($parameters);
330 330
 
331
-            if (! $suppress) {
331
+            if (!$suppress) {
332 332
                 $console->end();
333 333
             }
334 334
 
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
 
344 344
     private function registerException(Logger $logger)
345 345
     {
346
-        $this->onException(static function (Throwable $e, int $exitCode) use ($logger) {
346
+        $this->onException(static function(Throwable $e, int $exitCode) use ($logger) {
347 347
             $logger->error((string) $e, ['exitCode' => $exitCode, 'klinge' => true]);
348 348
 
349 349
             throw new CLIException($e->getMessage(), $exitCode, $e);
Please login to merge, or discard this patch.