Passed
Push — main ( 28baaa...23dfd3 )
by Dimitri
04:57
created
src/View/Adapters/NativeAdapter.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
         // Enregistrer les variables actuelles
121 121
         $renderVars = $this->renderVars;
122 122
 
123
-        $output = (function (): string {
123
+        $output = (function(): string {
124 124
             extract($this->tempData);
125 125
             ob_start();
126 126
             include $this->renderVars['file'];
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 
142 142
         $this->logPerformance($this->renderVars['start'], microtime(true), $this->renderVars['view']);
143 143
 
144
-        if (($this->debug && (! isset($options['debug']) || $options['debug'] === true))) {
144
+        if (($this->debug && (!isset($options['debug']) || $options['debug'] === true))) {
145 145
             if (in_array(ViewsCollector::class, config('toolbar.collectors'), true)) {
146 146
                 // Nettoyer nos noms de chemins pour les rendre un peu plus propres
147 147
                 $this->renderVars['file'] = clean_path($this->renderVars['file']);
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
         $saveData ??= $this->saveData;
178 178
         $this->prepareTemplateData($saveData);
179 179
 
180
-        $output = (function (string $view): string {
180
+        $output = (function(string $view): string {
181 181
             extract($this->tempData);
182 182
             ob_start();
183 183
             eval('?>' . $view);
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
         $section = array_pop($this->sectionStack);
321 321
 
322 322
         // Assurez-vous qu'un tableau existe afin que nous puissions stocker plusieurs entrées pour cela.
323
-        if (! array_key_exists($section, $this->sections)) {
323
+        if (!array_key_exists($section, $this->sections)) {
324 324
             $this->sections[$section] = [];
325 325
         }
326 326
 
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
      */
357 357
     public function show(string $sectionName, bool $preserve = false)
358 358
     {
359
-        if (! isset($this->sections[$sectionName])) {
359
+        if (!isset($this->sections[$sectionName])) {
360 360
             echo '';
361 361
 
362 362
             return;
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
      *
414 414
      * @alias self::insert()
415 415
      */
416
-    public function include(string $view, ?array $data = [], ?array $options = null, ?bool $saveData = null): string
416
+    public function include(string $view, ?array $data = [], ?array $options = null, ?bool $saveData = null) : string
417 417
     {
418 418
         return $this->insert($view, $data, $options, $saveData);
419 419
     }
@@ -586,7 +586,7 @@  discard block
 block discarded – undo
586 586
     public function addLibCss(string ...$src): self
587 587
     {
588 588
         foreach ($src as $var) {
589
-            if (! in_array($var, $this->_lib_styles, true)) {
589
+            if (!in_array($var, $this->_lib_styles, true)) {
590 590
                 $this->_lib_styles[] = $var;
591 591
             }
592 592
         }
@@ -600,7 +600,7 @@  discard block
 block discarded – undo
600 600
     public function addCss(string ...$src): self
601 601
     {
602 602
         foreach ($src as $var) {
603
-            if (! in_array($var, $this->_styles, true)) {
603
+            if (!in_array($var, $this->_styles, true)) {
604 604
                 $this->_styles[] = $var;
605 605
             }
606 606
         }
@@ -629,10 +629,10 @@  discard block
 block discarded – undo
629 629
             );
630 630
         }
631 631
 
632
-        if (! empty($lib_styles)) {
632
+        if (!empty($lib_styles)) {
633 633
             lib_styles(array_unique($lib_styles));
634 634
         }
635
-        if (! empty($styles)) {
635
+        if (!empty($styles)) {
636 636
             styles(array_unique($styles));
637 637
         }
638 638
 
@@ -645,7 +645,7 @@  discard block
 block discarded – undo
645 645
     public function addLibJs(string ...$src): self
646 646
     {
647 647
         foreach ($src as $var) {
648
-            if (! in_array($var, $this->_lib_scripts, true)) {
648
+            if (!in_array($var, $this->_lib_scripts, true)) {
649 649
                 $this->_lib_scripts[] = $var;
650 650
             }
651 651
         }
@@ -659,7 +659,7 @@  discard block
 block discarded – undo
659 659
     public function addJs(string ...$src): self
660 660
     {
661 661
         foreach ($src as $var) {
662
-            if (! in_array($var, $this->_scripts, true)) {
662
+            if (!in_array($var, $this->_scripts, true)) {
663 663
                 $this->_scripts[] = $var;
664 664
             }
665 665
         }
@@ -688,10 +688,10 @@  discard block
 block discarded – undo
688 688
             );
689 689
         }
690 690
 
691
-        if (! empty($lib_scripts)) {
691
+        if (!empty($lib_scripts)) {
692 692
             lib_scripts(array_unique($lib_scripts));
693 693
         }
694
-        if (! empty($scripts)) {
694
+        if (!empty($scripts)) {
695 695
             scripts(array_unique($scripts));
696 696
         }
697 697
 
Please login to merge, or discard this patch.
src/Config/Config.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
      */
62 62
     public function exists(string $key): bool
63 63
     {
64
-        if (! $this->configurator->exists($key)) {
64
+        if (!$this->configurator->exists($key)) {
65 65
             $config = explode('.', $key);
66 66
             $this->load($config[0]);
67 67
 
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
      */
85 85
     public function missing(string $key): bool
86 86
     {
87
-        return ! $this->exists($key);
87
+        return !$this->exists($key);
88 88
     }
89 89
 
90 90
     /**
@@ -167,18 +167,18 @@  discard block
 block discarded – undo
167 167
                 }
168 168
                 $this->load($conf, $file, null, $allow_empty);
169 169
             }
170
-        } elseif (! isset(self::$loaded[$config])) {
170
+        } elseif (!isset(self::$loaded[$config])) {
171 171
             $file ??= self::path($config);
172 172
             $schema ??= self::schema($config);
173 173
 
174 174
             $configurations = [];
175
-            if (file_exists($file) && ! in_array($file, get_included_files(), true)) {
175
+            if (file_exists($file) && !in_array($file, get_included_files(), true)) {
176 176
                 $configurations = (array) require $file;
177 177
             }
178 178
 
179 179
             $configurations = Arr::merge(self::$registrars[$config] ?? [], $configurations);
180 180
 
181
-            if (empty($configurations) && ! $allow_empty && (empty($schema) || ! is_a($schema, Schema::class))) {
181
+            if (empty($configurations) && !$allow_empty && (empty($schema) || !is_a($schema, Schema::class))) {
182 182
                 return;
183 183
             }
184 184
 
@@ -279,14 +279,14 @@  discard block
 block discarded – undo
279 279
             }
280 280
 
281 281
             $class   = new ReflectionClass($classname);
282
-            $methods = $class->getMethods(ReflectionMethod::IS_STATIC | ReflectionMethod::IS_PUBLIC);
282
+            $methods = $class->getMethods(ReflectionMethod::IS_STATIC|ReflectionMethod::IS_PUBLIC);
283 283
 
284 284
             foreach ($methods as $method) {
285
-                if (! ($method->isPublic() && $method->isStatic())) {
285
+                if (!($method->isPublic() && $method->isStatic())) {
286 286
                     continue;
287 287
                 }
288 288
 
289
-                if (! is_array($result = $method->invoke(null))) {
289
+                if (!is_array($result = $method->invoke(null))) {
290 290
                     continue;
291 291
                 }
292 292
 
@@ -355,12 +355,12 @@  discard block
 block discarded – undo
355 355
     {
356 356
         $config = $this->get('app.show_debugbar', 'auto');
357 357
 
358
-        if (! in_array($config, ['auto', true, false], true)) {
358
+        if (!in_array($config, ['auto', true, false], true)) {
359 359
             self::exceptBadConfigValue('show_debugbar', ['auto', true, false], 'app');
360 360
         }
361 361
 
362 362
         if ($config === 'auto') {
363
-            $this->set('app.show_debugbar', ! is_online());
363
+            $this->set('app.show_debugbar', !is_online());
364 364
         }
365 365
     }
366 366
 
Please login to merge, or discard this patch.
src/Http/UrlGenerator.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 
271 271
         $route = $this->routes->reverseRoute($action, ...$parameters);
272 272
 
273
-        if (! $route) {
273
+        if (!$route) {
274 274
             throw RouterException::actionNotDefined($action);
275 275
         }
276 276
 
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
      */
342 342
     public function isValidUrl(string $path): bool
343 343
     {
344
-        if (! preg_match('~^(#|//|https?://|(mailto|tel|sms):)~', $path)) {
344
+        if (!preg_match('~^(#|//|https?://|(mailto|tel|sms):)~', $path)) {
345 345
             return filter_var($path, FILTER_VALIDATE_URL) !== false;
346 346
         }
347 347
 
Please login to merge, or discard this patch.
src/Router/Router.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
         // Toujours là ? Ensuite, nous pouvons essayer de faire correspondre l'URI avec
159 159
         // Contrôleurs/répertoires, mais l'application peut ne pas
160 160
         // vouloir ceci, comme dans le cas des API.
161
-        if (! $this->collection->shouldAutoRoute()) {
161
+        if (!$this->collection->shouldAutoRoute()) {
162 162
             throw new PageNotFoundException("Impossible de trouver une route pour '{$this->collection->getHTTPVerb()}: {$uri}'.");
163 163
         }
164 164
 
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
      */
189 189
     public function controllerName()
190 190
     {
191
-        if (! is_string($this->controller)) {
191
+        if (!is_string($this->controller)) {
192 192
             return $this->controller;
193 193
         }
194 194
 
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 
234 234
             return [
235 235
                 $routeArray[0], // Controller
236
-                $routeArray[1] ?? 'index',   // Method
236
+                $routeArray[1] ?? 'index', // Method
237 237
             ];
238 238
         }
239 239
 
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
                 // Cette route est-elle censée rediriger vers une autre ?
358 358
                 if ($this->collection->isRedirect($routeKey)) {
359 359
                     // remplacement des groupes de routes correspondants par des références : post/([0-9]+) -> post/$1
360
-                    $redirectTo = preg_replace_callback('/(\([^\(]+\))/', static function () {
360
+                    $redirectTo = preg_replace_callback('/(\([^\(]+\))/', static function() {
361 361
                         static $i = 1;
362 362
 
363 363
                         return '$' . $i++;
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
                     );
378 378
 
379 379
                     if ($this->collection->shouldUseSupportedLocalesOnly()
380
-                        && ! in_array($matched['locale'], config('app.supported_locales'), true)) {
380
+                        && !in_array($matched['locale'], config('app.supported_locales'), true)) {
381 381
                         // Lancer une exception pour empêcher l'autorouteur,
382 382
                         // si activé, essayer de trouver une route
383 383
                         throw PageNotFoundException::localeNotSupported($matched['locale']);
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
 
390 390
                 // Utilisons-nous Closures ? Si tel est le cas, nous devons collecter les paramètres dans un tableau
391 391
                 // afin qu'ils puissent être transmis ultérieurement à la méthode du contrôleur.
392
-                if (! is_string($handler) && is_callable($handler)) {
392
+                if (!is_string($handler) && is_callable($handler)) {
393 393
                     $this->controller = $handler;
394 394
 
395 395
                     // Supprime la chaîne d'origine du tableau matches
@@ -468,7 +468,7 @@  discard block
 block discarded – undo
468 468
 
469 469
         // $this->method contient déjà le nom de la méthode par défaut,
470 470
         // donc ne l'écrasez pas avec le vide.
471
-        if (! empty($method)) {
471
+        if (!empty($method)) {
472 472
             $this->setMethod($method);
473 473
         }
474 474
 
Please login to merge, or discard this patch.
src/Http/MiddlewareQueue.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
      */
233 233
     public function seek(int $position): void
234 234
     {
235
-        if (! isset($this->queue[$position])) {
235
+        if (!isset($this->queue[$position])) {
236 236
             throw new OutOfBoundsException(sprintf('Invalid seek position (%s).', $position));
237 237
         }
238 238
 
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
      */
253 253
     public function current(): MiddlewareInterface
254 254
     {
255
-        if (! isset($this->queue[$this->position])) {
255
+        if (!isset($this->queue[$this->position])) {
256 256
             throw new OutOfBoundsException(sprintf('Position actuelle non valide (%s).', $this->position));
257 257
         }
258 258
 
Please login to merge, or discard this patch.
src/Middlewares/BaseMiddleware.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
         $this->path = $path;
36 36
 
37 37
         foreach ($this->arguments as $argument => $value) {
38
-            if (! is_string($argument)) {
38
+            if (!is_string($argument)) {
39 39
                 continue;
40 40
             }
41 41
 
Please login to merge, or discard this patch.
src/Controllers/ApplicationController.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
         $options = (array) $options;
46 46
 
47 47
         // N'est-il pas namespaced ? on cherche le dossier en fonction du controleur
48
-        if (! str_contains($view, '\\')) {
48
+        if (!str_contains($view, '\\')) {
49 49
             $reflection                                      = new ReflectionClass(static::class);
50 50
             ['dirname' => $dirname, 'filename' => $filename] = pathinfo($reflection->getFileName());
51 51
             $dirname                                         = str_ireplace('Controllers', 'Views', $dirname);
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
             $dirname = implode('Views', $parts);
60 60
             $path    = implode(DS, [$dirname, $filename]) . DS;
61 61
             
62
-            if (! is_dir($path)) {
62
+            if (!is_dir($path)) {
63 63
                 $path = implode(DS, [$dirname]) . DS;
64 64
             }
65 65
         }
@@ -72,12 +72,12 @@  discard block
 block discarded – undo
72 72
             $viewer->layout($this->layout);
73 73
         }
74 74
 
75
-        if (! empty($this->viewDatas) && is_array($this->viewDatas)) {
75
+        if (!empty($this->viewDatas) && is_array($this->viewDatas)) {
76 76
             $viewer->addData($this->viewDatas);
77 77
         }
78 78
 
79 79
         if (empty($data['title'])) {
80
-            if (! is_string($controllerName = Dispatcher::getController(false))) {
80
+            if (!is_string($controllerName = Dispatcher::getController(false))) {
81 81
                 $controllerName = static::class;
82 82
             }
83 83
             $controllerName = str_ireplace(['App\Controllers', 'Controller'], '', $controllerName);
Please login to merge, or discard this patch.
src/Http/Uri.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -149,12 +149,12 @@  discard block
 block discarded – undo
149 149
 
150 150
         $authority = $this->host;
151 151
 
152
-        if (! empty($this->getUserInfo())) {
152
+        if (!empty($this->getUserInfo())) {
153 153
             $authority = $this->getUserInfo() . '@' . $authority;
154 154
         }
155 155
 
156 156
         // N'ajoute pas de port s'il s'agit d'un port standard pour ce schéma
157
-        if (! empty($this->port) && ! $ignorePort && $this->port !== $this->defaultPorts[$this->scheme]) {
157
+        if (!empty($this->port) && !$ignorePort && $this->port !== $this->defaultPorts[$this->scheme]) {
158 158
             $authority .= ':' . $this->port;
159 159
         }
160 160
 
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
     {
171 171
         $userInfo = $this->user ?: '';
172 172
 
173
-        if ($this->showPassword === true && ! empty($this->password)) {
173
+        if ($this->showPassword === true && !empty($this->password)) {
174 174
             $userInfo .= ':' . $this->password;
175 175
         }
176 176
 
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
         $vars = $this->query;
221 221
 
222 222
         if (array_key_exists('except', $options)) {
223
-            if (! is_array($options['except'])) {
223
+            if (!is_array($options['except'])) {
224 224
                 $options['except'] = [$options['except']];
225 225
             }
226 226
 
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
         } elseif (array_key_exists('only', $options)) {
231 231
             $temp = [];
232 232
 
233
-            if (! is_array($options['only'])) {
233
+            if (!is_array($options['only'])) {
234 234
                 $options['only'] = [$options['only']];
235 235
             }
236 236
 
@@ -344,11 +344,11 @@  discard block
 block discarded – undo
344 344
     public static function createURIString(?string $scheme = null, ?string $authority = null, ?string $path = null, ?string $query = null, ?string $fragment = null): string
345 345
     {
346 346
         $uri = '';
347
-        if (! empty($scheme)) {
347
+        if (!empty($scheme)) {
348 348
             $uri .= $scheme . '://';
349 349
         }
350 350
 
351
-        if (! empty($authority)) {
351
+        if (!empty($authority)) {
352 352
             $uri .= $authority;
353 353
         }
354 354
 
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
     {
377 377
         $parts = parse_url($str);
378 378
 
379
-        if (! isset($parts['path'])) {
379
+        if (!isset($parts['path'])) {
380 380
             $parts['path'] = $this->getPath();
381 381
         }
382 382
 
@@ -549,7 +549,7 @@  discard block
 block discarded – undo
549 549
         }
550 550
 
551 551
         // Ne peut pas avoir de début ?
552
-        if (! empty($query) && str_starts_with($query, '?')) {
552
+        if (!empty($query) && str_starts_with($query, '?')) {
553 553
             $query = substr($query, 1);
554 554
         }
555 555
 
@@ -625,7 +625,7 @@  discard block
 block discarded – undo
625 625
         $temp = [];
626 626
 
627 627
         foreach ($this->query as $key => $value) {
628
-            if (! in_array($key, $params, true)) {
628
+            if (!in_array($key, $params, true)) {
629 629
                 continue;
630 630
             }
631 631
 
@@ -700,19 +700,19 @@  discard block
 block discarded – undo
700 700
      */
701 701
     protected function applyParts(array $parts)
702 702
     {
703
-        if (! empty($parts['host'])) {
703
+        if (!empty($parts['host'])) {
704 704
             $this->host = $parts['host'];
705 705
         }
706
-        if (! empty($parts['user'])) {
706
+        if (!empty($parts['user'])) {
707 707
             $this->user = $parts['user'];
708 708
         }
709
-        if (! empty($parts['path'])) {
709
+        if (!empty($parts['path'])) {
710 710
             $this->path = $this->filterPath($parts['path']);
711 711
         }
712
-        if (! empty($parts['query'])) {
712
+        if (!empty($parts['query'])) {
713 713
             $this->setQuery($parts['query']);
714 714
         }
715
-        if (! empty($parts['fragment'])) {
715
+        if (!empty($parts['fragment'])) {
716 716
             $this->fragment = $parts['fragment'];
717 717
         }
718 718
 
@@ -760,7 +760,7 @@  discard block
 block discarded – undo
760 760
         $transformed = clone $relative;
761 761
 
762 762
         // 5.2.2 Transformer les références dans une méthode non stricte (pas de schéma)
763
-        if (! empty($relative->getAuthority())) {
763
+        if (!empty($relative->getAuthority())) {
764 764
             $transformed->setAuthority($relative->getAuthority())
765 765
                 ->setPath($relative->getPath())
766 766
                 ->setQuery($relative->getQuery());
@@ -800,7 +800,7 @@  discard block
 block discarded – undo
800 800
      */
801 801
     protected function mergePaths(self $base, self $reference): string
802 802
     {
803
-        if (! empty($base->getAuthority()) && '' === $base->getPath()) {
803
+        if (!empty($base->getAuthority()) && '' === $base->getPath()) {
804 804
             return '/' . ltrim($reference->getPath(), '/ ');
805 805
         }
806 806
 
@@ -883,7 +883,7 @@  discard block
 block discarded – undo
883 883
             $basePath = trim($baseUri->getPath(), '/') . '/';
884 884
             $trimPath = ltrim($path, '/');
885 885
 
886
-            if ($basePath !== '/' && ! str_starts_with($trimPath, $basePath)) {
886
+            if ($basePath !== '/' && !str_starts_with($trimPath, $basePath)) {
887 887
                 $path = $basePath . $trimPath;
888 888
             }
889 889
 
Please login to merge, or discard this patch.