Passed
Push — main ( d73a9f...e9e84e )
by
unknown
09:56 queued 06:21
created
src/Mail/Mail.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
      */
113 113
     protected function factory(): AbstractAdapter
114 114
     {
115
-        if (! empty($this->adapter)) {
115
+        if (!empty($this->adapter)) {
116 116
             return $this->adapter;
117 117
         }
118 118
 
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
             $handler = static::$validHandlers[$handler];
127 127
         }
128 128
 
129
-        if (! class_exists($handler)) {
129
+        if (!class_exists($handler)) {
130 130
             throw new InvalidArgumentException(lang('Mail.invalidHandler', [$handler]));
131 131
         }
132 132
 
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
             $debug = on_dev();
136 136
         }
137 137
 
138
-        if (! is_subclass_of($handler, AbstractAdapter::class)) {
138
+        if (!is_subclass_of($handler, AbstractAdapter::class)) {
139 139
             throw new InvalidArgumentException(lang('Mail.handlerMustExtendClass', [$handler, AbstractAdapter::class]));
140 140
         }
141 141
 
@@ -341,15 +341,15 @@  discard block
 block discarded – undo
341 341
         $path = '';
342 342
 
343 343
         // N'est-il pas namespaced ? on cherche le dossier en fonction du parametre "view_base"
344
-        if (! str_contains($view, '\\')) {
344
+        if (!str_contains($view, '\\')) {
345 345
             $path = $this->config['view_dir'] ?? '';
346
-            if (! empty($path)) {
346
+            if (!empty($path)) {
347 347
                 $path .= '/';
348 348
             }
349 349
         }
350 350
 
351 351
         $view = view($path . $view, $data);
352
-        if (! empty($this->config['template'])) {
352
+        if (!empty($this->config['template'])) {
353 353
             $view->layout($this->config['template']);
354 354
         }
355 355
 
Please login to merge, or discard this patch.
src/Helpers/url.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 
26 26
 // =================================  ================================= //
27 27
 
28
-if (! function_exists('url')) {
28
+if (!function_exists('url')) {
29 29
     /**
30 30
      * Générer une url pour l'application.
31 31
      *
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
     }
45 45
 }
46 46
 
47
-if (! function_exists('site_url')) {
47
+if (!function_exists('site_url')) {
48 48
     /**
49 49
      * Renvoie une URL de site telle que définie par la configuration de l'application.
50 50
      *
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
     }
69 69
 }
70 70
 
71
-if (! function_exists('base_url')) {
71
+if (!function_exists('base_url')) {
72 72
     /**
73 73
      * Renvoie l'URL de base telle que définie par la configuration de l'application.
74 74
      * Les URL de base sont des URL de site coupées sans la page d'index.
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
     }
88 88
 }
89 89
 
90
-if (! function_exists('current_url')) {
90
+if (!function_exists('current_url')) {
91 91
     /**
92 92
      * Renvoie l'URL complète (y compris les segments) de la page où cette fonction est placée
93 93
      *
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
     }
115 115
 }
116 116
 
117
-if (! function_exists('previous_url')) {
117
+if (!function_exists('previous_url')) {
118 118
     /**
119 119
      * Renvoie l'URL précédente sur laquelle se trouvait le visiteur actuel. Pour des raisons de sécurité
120 120
      * nous vérifions d'abord une variable de session enregistrée, si elle existe, et l'utilisons.
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
     }
132 132
 }
133 133
 
134
-if (! function_exists('uri_string')) {
134
+if (!function_exists('uri_string')) {
135 135
     /**
136 136
      * Renvoie la partie chemin de l'URL actuelle
137 137
      *
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
     }
146 146
 }
147 147
 
148
-if (! function_exists('index_page')) {
148
+if (!function_exists('index_page')) {
149 149
     /**
150 150
      * Renvoie la "index_page" de votre fichier de configuration
151 151
      */
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
     }
156 156
 }
157 157
 
158
-if (! function_exists('anchor')) {
158
+if (!function_exists('anchor')) {
159 159
     /**
160 160
      * Crée une ancre basée sur l'URL locale.
161 161
      *
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
     }
181 181
 }
182 182
 
183
-if (! function_exists('anchor_popup')) {
183
+if (!function_exists('anchor_popup')) {
184 184
     /**
185 185
      * Lien d'ancrage - Version contextuelle
186 186
      *
@@ -203,12 +203,12 @@  discard block
 block discarded – undo
203 203
             return '<a href="' . $siteUrl . '" onclick="window.open(\'' . $siteUrl . "', '_blank'); return false;\">" . $title . '</a>';
204 204
         }
205 205
 
206
-        if (! is_array($attributes)) {
206
+        if (!is_array($attributes)) {
207 207
             $attributes = [$attributes];
208 208
 
209 209
             // Ref: http://www.w3schools.com/jsref/met_win_open.asp
210 210
             $windowName = '_blank';
211
-        } elseif (! empty($attributes['window_name'])) {
211
+        } elseif (!empty($attributes['window_name'])) {
212 212
             $windowName = $attributes['window_name'];
213 213
             unset($attributes['window_name']);
214 214
         } else {
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
     }
229 229
 }
230 230
 
231
-if (! function_exists('mailto')) {
231
+if (!function_exists('mailto')) {
232 232
     /**
233 233
      * Lien Mailto
234 234
      *
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
     }
246 246
 }
247 247
 
248
-if (! function_exists('safe_mailto')) {
248
+if (!function_exists('safe_mailto')) {
249 249
     /**
250 250
      * Lien Mailto codé
251 251
      *
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
     }
337 337
 }
338 338
 
339
-if (! function_exists('auto_link')) {
339
+if (!function_exists('auto_link')) {
340 340
     /**
341 341
      * Lien automatique
342 342
      *
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
     function auto_link(string $str, string $type = 'both', bool $popup = false): string
352 352
     {
353 353
         // Recherche et remplace tous les URLs.
354
-        if ($type !== 'email' && preg_match_all('#(\w*://|www\.)[^\s()<>;]+\w#i', $str, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER)) {
354
+        if ($type !== 'email' && preg_match_all('#(\w*://|www\.)[^\s()<>;]+\w#i', $str, $matches, PREG_OFFSET_CAPTURE|PREG_SET_ORDER)) {
355 355
             // Définissez notre HTML cible si vous utilisez des liens contextuels.
356 356
             $target = ($popup) ? ' target="_blank"' : '';
357 357
 
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
     }
383 383
 }
384 384
 
385
-if (! function_exists('prep_url')) {
385
+if (!function_exists('prep_url')) {
386 386
     /**
387 387
      * Ajoute simplement la partie http:// ou https:// si aucun schéma n'est inclus.
388 388
      *
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
     }
408 408
 }
409 409
 
410
-if (! function_exists('url_title')) {
410
+if (!function_exists('url_title')) {
411 411
     /**
412 412
      * Créer un titre d'URL
413 413
      *
@@ -443,7 +443,7 @@  discard block
 block discarded – undo
443 443
     }
444 444
 }
445 445
 
446
-if (! function_exists('mb_url_title')) {
446
+if (!function_exists('mb_url_title')) {
447 447
     /**
448 448
      * Créer un titre d'URL qui prend en compte les caractères accentués
449 449
      *
@@ -462,7 +462,7 @@  discard block
 block discarded – undo
462 462
     }
463 463
 }
464 464
 
465
-if (! function_exists('url_to')) {
465
+if (!function_exists('url_to')) {
466 466
     /**
467 467
      * Obtenir l'URL complète et absolue d'une méthode de contrôleur
468 468
      * (avec arguments supplémentaires)
@@ -475,7 +475,7 @@  discard block
 block discarded – undo
475 475
      */
476 476
     function url_to(string $controller, ...$args): string
477 477
     {
478
-        if (! $route = route($controller, ...$args)) {
478
+        if (!$route = route($controller, ...$args)) {
479 479
             $explode = explode('::', $controller);
480 480
 
481 481
             if (isset($explode[1])) {
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
     }
490 490
 }
491 491
 
492
-if (! function_exists('route')) {
492
+if (!function_exists('route')) {
493 493
     /**
494 494
      * Tente de rechercher une route en fonction de sa destination.
495 495
      *
@@ -501,7 +501,7 @@  discard block
 block discarded – undo
501 501
     }
502 502
 }
503 503
 
504
-if (! function_exists('action')) {
504
+if (!function_exists('action')) {
505 505
     /**
506 506
      * Obtenir l'URL d'une action du contrôleur.
507 507
      *
@@ -513,7 +513,7 @@  discard block
 block discarded – undo
513 513
     }
514 514
 }
515 515
 
516
-if (! function_exists('url_is')) {
516
+if (!function_exists('url_is')) {
517 517
     /**
518 518
      * Détermine si le chemin d'URL actuel contient le chemin donné.
519 519
      * Il peut contenir un caractère générique (*) qui autorisera tout caractère valide.
@@ -531,7 +531,7 @@  discard block
 block discarded – undo
531 531
     }
532 532
 }
533 533
 
534
-if (! function_exists('link_active')) {
534
+if (!function_exists('link_active')) {
535 535
     /**
536 536
      * Lien actif dans la navbar
537 537
      * Un peut comme le router-active-link de vuejs
@@ -555,7 +555,7 @@  discard block
 block discarded – undo
555 555
             return $active_class;
556 556
         }
557 557
 
558
-        if (! $exact && preg_match('#^' . $path . '/?#i', $current_section)) {
558
+        if (!$exact && preg_match('#^' . $path . '/?#i', $current_section)) {
559 559
             return $active_class;
560 560
         }
561 561
 
@@ -567,14 +567,14 @@  discard block
 block discarded – undo
567 567
     }
568 568
 }
569 569
 
570
-if (! function_exists('clean_url')) {
570
+if (!function_exists('clean_url')) {
571 571
     function clean_url(string $url): string
572 572
     {
573 573
         return Helpers::cleanUrl($url);
574 574
     }
575 575
 }
576 576
 
577
-if (! function_exists('is_absolute_link')) {
577
+if (!function_exists('is_absolute_link')) {
578 578
     /**
579 579
      * Verifies si un chemin donnée est une url absolue ou relative
580 580
      */
Please login to merge, or discard this patch.
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.