Passed
Push — main ( c6deb1...79ccdf )
by Dimitri
12:23
created
src/Initializer/bootstrap.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -81,10 +81,10 @@
 block discarded – undo
81 81
      */
82 82
     require_once SYST_PATH . 'Helpers' . DS . 'common.php';
83 83
 
84
-	/**
85
-	 * On initialise le parsing du fichier .env
86
-	 */
87
-	DotEnv::init(ROOTPATH);
84
+    /**
85
+     * On initialise le parsing du fichier .env
86
+     */
87
+    DotEnv::init(ROOTPATH);
88 88
 
89 89
     // Initialise et enregistre le loader avec la pile SPL autoloader.
90 90
     Services::autoloader()->initialize()->register();
Please login to merge, or discard this patch.
src/Router/DefinedRouteCollector.php 2 patches
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -20,10 +20,10 @@  discard block
 block discarded – undo
20 20
 {
21 21
     private RouteCollection $routeCollection;
22 22
 
23
-	/**
24
-	 * Routes deja collectees (pour eviter de faire la meme chose plusieurs fois)
25
-	 */
26
-	private array $cachedRoutes = [];
23
+    /**
24
+     * Routes deja collectees (pour eviter de faire la meme chose plusieurs fois)
25
+     */
26
+    private array $cachedRoutes = [];
27 27
 
28 28
     public function __construct(RouteCollection $routes)
29 29
     {
@@ -35,9 +35,9 @@  discard block
 block discarded – undo
35 35
      */
36 36
     public function collect(bool $reset = true): array
37 37
     {
38
-		if (! $reset && $this->cachedRoutes !== []) {
39
-			return $this->cachedRoutes;
40
-		}
38
+        if (! $reset && $this->cachedRoutes !== []) {
39
+            return $this->cachedRoutes;
40
+        }
41 41
 
42 42
         $methods = [
43 43
             'get',
@@ -52,12 +52,12 @@  discard block
 block discarded – undo
52 52
             'cli',
53 53
         ];
54 54
 
55
-		$definedRoutes = [];
55
+        $definedRoutes = [];
56 56
 
57 57
         foreach ($methods as $method) {
58 58
             $routes = $this->routeCollection->getRoutes($method);
59 59
 
60
-			foreach ($routes as $route => $handler) {
60
+            foreach ($routes as $route => $handler) {
61 61
                 if (is_string($handler) || $handler instanceof Closure) {
62 62
                     if ($handler instanceof Closure) {
63 63
                         $view = $this->routeCollection->getRoutesOptions($route, $method)['view'] ?? false;
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 
68 68
                     $routeName = $this->routeCollection->getRoutesOptions($route, $method)['as'] ?? $route;
69 69
 
70
-					$definedRoutes[] = [
70
+                    $definedRoutes[] = [
71 71
                         'method'  => $method,
72 72
                         'route'   => $route,
73 73
                         'name'    => $routeName,
@@ -77,6 +77,6 @@  discard block
 block discarded – undo
77 77
             }
78 78
         }
79 79
 
80
-		return $this->cachedRoutes = $definedRoutes;
80
+        return $this->cachedRoutes = $definedRoutes;
81 81
     }
82 82
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
      */
36 36
     public function collect(bool $reset = true): array
37 37
     {
38
-		if (! $reset && $this->cachedRoutes !== []) {
38
+		if (!$reset && $this->cachedRoutes !== []) {
39 39
 			return $this->cachedRoutes;
40 40
 		}
41 41
 
Please login to merge, or discard this patch.
src/Router/RouteCollection.php 2 patches
Indentation   +90 added lines, -90 removed lines patch added patch discarded remove patch
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 
122 122
     /**
123 123
      * Tableau des noms des routes
124
-	 * 
124
+     * 
125 125
      * [
126 126
      *     verb => [
127 127
      *         routeName => routeKey(regex)
@@ -220,14 +220,14 @@  discard block
 block discarded – undo
220 220
 
221 221
     /**
222 222
      * Constructor
223
-	 * 
224
-	 * @var Locator $locator Descripteur du localisateur de fichiers à utiliser.
223
+     * 
224
+     * @var Locator $locator Descripteur du localisateur de fichiers à utiliser.
225 225
      */
226 226
     public function __construct(protected Locator $locator, object $routing)
227 227
     {
228 228
         $this->httpHost = Services::request()->getEnv('HTTP_HOST');
229 229
 
230
-		// Configuration basée sur le fichier de config. Laissez le fichier routes substituer.
230
+        // Configuration basée sur le fichier de config. Laissez le fichier routes substituer.
231 231
         $this->defaultNamespace   = $routing->default_namespace ?: $this->defaultNamespace;
232 232
         $this->defaultController  = $routing->default_controller ?: $this->defaultController;
233 233
         $this->defaultMethod      = $routing->default_method ?: $this->defaultMethod;
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
         $this->routeFiles         = $routing->route_files ?: $this->routeFiles;
238 238
         $this->prioritize         = $routing->prioritize ?: $this->prioritize;
239 239
 
240
-		// Normaliser la chaîne de path dans le tableau routeFiles.
240
+        // Normaliser la chaîne de path dans le tableau routeFiles.
241 241
         foreach ($this->routeFiles as $routeKey => $routesFile) {
242 242
             $this->routeFiles[$routeKey] = realpath($routesFile) ?: $routesFile;
243 243
         }
@@ -255,18 +255,18 @@  discard block
 block discarded – undo
255 255
         }
256 256
 
257 257
         // Incluez le fichier routesFile s'il n'existe pas. 
258
-		// Ne conserver que pour les fins BC pour l'instant. 
258
+        // Ne conserver que pour les fins BC pour l'instant. 
259 259
         $routeFiles = $this->routeFiles;
260 260
         if (! in_array($routesFile, $routeFiles, true)) {
261 261
             $routeFiles[] = $routesFile;
262 262
         }
263 263
 		
264
-		// Nous avons besoin de cette variable dans la portée locale pour que les fichiers de route puissent y accéder.
264
+        // Nous avons besoin de cette variable dans la portée locale pour que les fichiers de route puissent y accéder.
265 265
         $routes = $this;
266 266
 
267
-		foreach ($routeFiles as $routesFile) {
267
+        foreach ($routeFiles as $routesFile) {
268 268
             if (! is_file($routesFile)) {
269
-				logger()->warning(sprintf('Fichier de route introuvable : "%s"', $routesFile));
269
+                logger()->warning(sprintf('Fichier de route introuvable : "%s"', $routesFile));
270 270
 
271 271
                 continue;
272 272
             }
@@ -288,11 +288,11 @@  discard block
 block discarded – undo
288 288
         $this->routes = $this->routesNames = ['*' => []];
289 289
 
290 290
         foreach ($this->defaultHTTPMethods as $verb) {
291
-			$this->routes[$verb]      = [];
292
-			$this->routesNames[$verb] = [];
291
+            $this->routes[$verb]      = [];
292
+            $this->routesNames[$verb] = [];
293 293
         }
294 294
 
295
-		$this->routesOptions = [];
295
+        $this->routesOptions = [];
296 296
 
297 297
         $this->prioritizeDetected = false;
298 298
         $this->didDiscover        = false;
@@ -542,9 +542,9 @@  discard block
 block discarded – undo
542 542
         if (isset($this->routes[$verb])) {
543 543
             // Conserve les itinéraires du verbe actuel au début afin qu'ils soient
544 544
             // mis en correspondance avant l'un des itinéraires génériques "add".
545
-			$collection = $includeWildcard ? $this->routes[$verb] + ($this->routes['*'] ?? []) : $this->routes[$verb];
545
+            $collection = $includeWildcard ? $this->routes[$verb] + ($this->routes['*'] ?? []) : $this->routes[$verb];
546 546
 
547
-		    foreach ($collection as $routeKey => $r) {
547
+            foreach ($collection as $routeKey => $r) {
548 548
                 $routes[$routeKey] = $r['handler'];
549 549
             }
550 550
         }
@@ -631,7 +631,7 @@  discard block
 block discarded – undo
631 631
     {
632 632
         // Utilisez le modèle de la route nommée s'il s'agit d'une route nommée.
633 633
         if (array_key_exists($to, $this->routesNames['*'])) {
634
-			$routeName  = $to;
634
+            $routeName  = $to;
635 635
             $routeKey   = $this->routesNames['*'][$routeName];
636 636
             $redirectTo = [$routeKey => $this->routes['*'][$routeKey]['handler']];
637 637
 
@@ -651,18 +651,18 @@  discard block
 block discarded – undo
651 651
 
652 652
     /**
653 653
      * {@inheritDoc}
654
-	 * 
655
-	 * @param string $routeKey cle de route ou route nommee
654
+     * 
655
+     * @param string $routeKey cle de route ou route nommee
656 656
      */
657 657
     public function isRedirect(string $routeKey): bool
658 658
     {
659
-		return isset($this->routes['*'][$routeKey]['redirect']);
659
+        return isset($this->routes['*'][$routeKey]['redirect']);
660 660
     }
661 661
 
662 662
     /**
663 663
      * {@inheritDoc}
664
-	 * 
665
-	 * @param string $routeKey cle de route ou route nommee
664
+     * 
665
+     * @param string $routeKey cle de route ou route nommee
666 666
      */
667 667
     public function getRedirectCode(string $routeKey): int
668 668
     {
@@ -785,59 +785,59 @@  discard block
 block discarded – undo
785 785
             }
786 786
         }
787 787
 
788
-		$routeName = $name;
789
-		if (isset($options['as']) || isset($options['name'])) {
790
-			$routeName = trim($options['as'] ?? $options['name'], " .");
791
-			unset($options['name'], $options['as']);
792
-		}
788
+        $routeName = $name;
789
+        if (isset($options['as']) || isset($options['name'])) {
790
+            $routeName = trim($options['as'] ?? $options['name'], " .");
791
+            unset($options['name'], $options['as']);
792
+        }
793 793
 
794 794
         if (in_array('index', $methods, true)) {
795 795
             $this->get($name, $newName . '::index', $options + [
796
-				'as' => $routeName . '.index',
797
-			]);
796
+                'as' => $routeName . '.index',
797
+            ]);
798 798
         }
799 799
         if (in_array('new', $methods, true)) {
800 800
             $this->get($name . '/new', $newName . '::new', $options + [
801
-				'as' => $routeName . '.new',
802
-			]);
801
+                'as' => $routeName . '.new',
802
+            ]);
803 803
         }
804 804
         if (in_array('edit', $methods, true)) {
805 805
             $this->get($name . '/' . $id . '/edit', $newName . '::edit/$1', $options + [
806
-				'as' => $routeName . '.edit',
807
-			]);
806
+                'as' => $routeName . '.edit',
807
+            ]);
808 808
         }
809 809
         if (in_array('show', $methods, true)) {
810 810
             $this->get($name . '/' . $id, $newName . '::show/$1', $options + [
811
-				'as' => $routeName . '.show',
812
-			]);
811
+                'as' => $routeName . '.show',
812
+            ]);
813 813
         }
814 814
         if (in_array('create', $methods, true)) {
815 815
             $this->post($name, $newName . '::create', $options + [
816
-				'as' => $routeName . '.create',
817
-			]);
816
+                'as' => $routeName . '.create',
817
+            ]);
818 818
         }
819 819
         if (in_array('update', $methods, true)) {
820
-			$this->match(['put', 'patch'], $name . '/' . $id, $newName . '::update/$1', $options + [
821
-				'as' => $routeName . '.update',
822
-			]);
820
+            $this->match(['put', 'patch'], $name . '/' . $id, $newName . '::update/$1', $options + [
821
+                'as' => $routeName . '.update',
822
+            ]);
823 823
         }
824 824
         if (in_array('delete', $methods, true)) {
825 825
             $this->delete($name . '/' . $id, $newName . '::delete/$1', $options + [
826
-				'as' => $routeName . '.delete',
827
-			]);
826
+                'as' => $routeName . '.delete',
827
+            ]);
828 828
         }
829 829
 
830 830
         // Websafe ? la suppression doit être vérifiée avant la mise à jour en raison du nom de la méthode
831 831
         if (isset($options['websafe'])) {
832 832
             if (in_array('delete', $methods, true)) {
833 833
                 $this->post($name . '/' . $id . '/delete', $newName . '::delete/$1', $options + [
834
-					'as' => $routeName . '.websafe.delete',
835
-				]);
834
+                    'as' => $routeName . '.websafe.delete',
835
+                ]);
836 836
             }
837 837
             if (in_array('update', $methods, true)) {
838 838
                 $this->post($name . '/' . $id, $newName . '::update/$1', $options + [
839
-					'as' => $routeName . '.websafe.update',
840
-				]);
839
+                    'as' => $routeName . '.websafe.update',
840
+                ]);
841 841
             }
842 842
         }
843 843
 
@@ -902,57 +902,57 @@  discard block
 block discarded – undo
902 902
             }
903 903
         }
904 904
 
905
-		$routeName = $name;
906
-		if (isset($options['as']) || isset($options['name'])) {
907
-			$routeName = trim($options['as'] ?? $options['name'], " .");
908
-			unset($options['name'], $options['as']);
909
-		}
905
+        $routeName = $name;
906
+        if (isset($options['as']) || isset($options['name'])) {
907
+            $routeName = trim($options['as'] ?? $options['name'], " .");
908
+            unset($options['name'], $options['as']);
909
+        }
910 910
 
911 911
         if (in_array('index', $methods, true)) {
912 912
             $this->get($name, $newName . '::index', $options + [
913
-				'as' => $routeName . '.index',
914
-			]);
913
+                'as' => $routeName . '.index',
914
+            ]);
915 915
         }
916 916
         if (in_array('show', $methods, true)) {
917 917
             $this->get($name . '/show/' . $id, $newName . '::show/$1', $options + [
918
-				'as' => $routeName . '.view'
919
-			]);
920
-			$this->get($name . '/' . $id, $newName . '::show/$1', $options + [
921
-				'as' => $routeName . '.show'
922
-			]);
918
+                'as' => $routeName . '.view'
919
+            ]);
920
+            $this->get($name . '/' . $id, $newName . '::show/$1', $options + [
921
+                'as' => $routeName . '.show'
922
+            ]);
923 923
         }
924 924
         if (in_array('new', $methods, true)) {
925 925
             $this->get($name . '/new', $newName . '::new', $options + [
926
-				'as' => $routeName . '.new'
927
-			]);
926
+                'as' => $routeName . '.new'
927
+            ]);
928 928
         }
929 929
         if (in_array('create', $methods, true)) {
930 930
             $this->post($name . '/create', $newName . '::create', $options + [
931
-				'as' => $routeName . '.create'
932
-			]);
933
-			$this->post($name, $newName . '::create', $options + [
934
-				'as' => $routeName . '.store'
935
-			]);
931
+                'as' => $routeName . '.create'
932
+            ]);
933
+            $this->post($name, $newName . '::create', $options + [
934
+                'as' => $routeName . '.store'
935
+            ]);
936 936
         }
937 937
         if (in_array('edit', $methods, true)) {
938 938
             $this->get($name . '/edit/' . $id, $newName . '::edit/$1', $options + [
939
-				'as' => $routeName . '.edit'
940
-			]);
939
+                'as' => $routeName . '.edit'
940
+            ]);
941 941
         }
942 942
         if (in_array('update', $methods, true)) {
943 943
             $this->post($name . '/update/' . $id, $newName . '::update/$1', $options + [
944
-				'as' => $routeName . '.update',
945
-			]);
944
+                'as' => $routeName . '.update',
945
+            ]);
946 946
         }
947 947
         if (in_array('remove', $methods, true)) {
948 948
             $this->get($name . '/remove/' . $id, $newName . '::remove/$1', $options + [
949
-				'as' => $routeName . '.remove',
950
-			]);
949
+                'as' => $routeName . '.remove',
950
+            ]);
951 951
         }
952 952
         if (in_array('delete', $methods, true)) {
953 953
             $this->post($name . '/delete/' . $id, $newName . '::delete/$1', $options + [
954
-				'as' => $routeName . '.delete',
955
-			]);
954
+                'as' => $routeName . '.delete',
955
+            ]);
956 956
         }
957 957
         
958 958
         return $this;
@@ -1066,17 +1066,17 @@  discard block
 block discarded – undo
1066 1066
     }
1067 1067
 
1068 1068
     
1069
-	/**
1069
+    /**
1070 1070
      * Spécifie une route qui n'est disponible que pour les requêtes GET et POST.
1071 1071
      *
1072 1072
      * @param array|Closure|string $to
1073 1073
      */
1074
-	public function form(string $from, $to, ?array $options = null): self
1075
-	{
1076
-		return $this->match(['GET', 'POST'], $from, $to, $options);
1077
-	}
1074
+    public function form(string $from, $to, ?array $options = null): self
1075
+    {
1076
+        return $this->match(['GET', 'POST'], $from, $to, $options);
1077
+    }
1078 1078
 	
1079
-	/**
1079
+    /**
1080 1080
      * Spécifie une route qui n'est disponible que pour les requêtes de ligne de commande.
1081 1081
      *
1082 1082
      * @param array|Closure|string $to
@@ -1100,10 +1100,10 @@  discard block
 block discarded – undo
1100 1100
             ->setOptions($options)
1101 1101
             ->render();
1102 1102
 
1103
-		$routeOptions = $options ?? [];
1104
-		$routeOptions = array_merge($routeOptions, ['view' => $view]);
1103
+        $routeOptions = $options ?? [];
1104
+        $routeOptions = array_merge($routeOptions, ['view' => $view]);
1105 1105
 
1106
-		$this->create('get', $from, $to, $routeOptions);
1106
+        $this->create('get', $from, $to, $routeOptions);
1107 1107
 
1108 1108
         return $this;
1109 1109
     }
@@ -1359,7 +1359,7 @@  discard block
 block discarded – undo
1359 1359
             }
1360 1360
         }
1361 1361
 
1362
-		$routeKey = $from;
1362
+        $routeKey = $from;
1363 1363
 
1364 1364
         // Remplacez nos espaces réservés de regex par la chose réelle
1365 1365
         // pour que le routeur n'ait pas besoin de savoir quoi que ce soit.
@@ -1391,7 +1391,7 @@  discard block
 block discarded – undo
1391 1391
             return;
1392 1392
         }
1393 1393
 
1394
-		$this->routes[$verb][$routeKey] = [
1394
+        $this->routes[$verb][$routeKey] = [
1395 1395
             'name'    => $name,
1396 1396
             'handler' => $to,
1397 1397
             'from'    => $from,
@@ -1494,15 +1494,15 @@  discard block
 block discarded – undo
1494 1494
         return array_shift($host);
1495 1495
     }
1496 1496
 
1497
-	/**
1498
-	 * Formate le nom des routes
1499
-	 */
1500
-	private function formatRouteName(string $name): string
1501
-	{
1502
-		$name = trim($name, '/');
1497
+    /**
1498
+     * Formate le nom des routes
1499
+     */
1500
+    private function formatRouteName(string $name): string
1501
+    {
1502
+        $name = trim($name, '/');
1503 1503
 
1504
-		return strtolower(str_replace(['/', '\\', '_', '.', ' '], '.', $name));
1505
-	}
1504
+        return strtolower(str_replace(['/', '\\', '_', '.', ' '], '.', $name));
1505
+    }
1506 1506
 
1507 1507
     private function getControllerName(Closure|string $handler): ?string
1508 1508
     {
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
         // Incluez le fichier routesFile s'il n'existe pas. 
258 258
 		// Ne conserver que pour les fins BC pour l'instant. 
259 259
         $routeFiles = $this->routeFiles;
260
-        if (! in_array($routesFile, $routeFiles, true)) {
260
+        if (!in_array($routesFile, $routeFiles, true)) {
261 261
             $routeFiles[] = $routesFile;
262 262
         }
263 263
 		
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
         $routes = $this;
266 266
 
267 267
 		foreach ($routeFiles as $routesFile) {
268
-            if (! is_file($routesFile)) {
268
+            if (!is_file($routesFile)) {
269 269
 				logger()->warning(sprintf('Fichier de route introuvable : "%s"', $routesFile));
270 270
 
271 271
                 continue;
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
      */
304 304
     public function addPlaceholder($placeholder, ?string $pattern = null): self
305 305
     {
306
-        if (! is_array($placeholder)) {
306
+        if (!is_array($placeholder)) {
307 307
             $placeholder = [$placeholder => $pattern];
308 308
         }
309 309
 
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
         // Nous avons besoin de cette variable dans la portée locale pour que les fichiers de route puissent y accéder.
395 395
         $routes = $this;
396 396
 
397
-        $files    = $this->locator->search('Config/routes.php');
397
+        $files = $this->locator->search('Config/routes.php');
398 398
         
399 399
         foreach ($files as $file) {
400 400
             // N'incluez plus notre fichier principal...
@@ -538,7 +538,7 @@  discard block
 block discarded – undo
538 538
         // que nous pourrions avoir besoin de faire.
539 539
         $this->discoverRoutes();
540 540
 
541
-        $routes     = [];
541
+        $routes = [];
542 542
         if (isset($this->routes[$verb])) {
543 543
             // Conserve les itinéraires du verbe actuel au début afin qu'ils soient
544 544
             // mis en correspondance avant l'un des itinéraires génériques "add".
@@ -631,7 +631,7 @@  discard block
 block discarded – undo
631 631
     {
632 632
         // Utilisez le modèle de la route nommée s'il s'agit d'une route nommée.
633 633
         if (array_key_exists($to, $this->routesNames['*'])) {
634
-			$routeName  = $to;
634
+			$routeName = $to;
635 635
             $routeKey   = $this->routesNames['*'][$routeName];
636 636
             $redirectTo = [$routeKey => $this->routes['*'][$routeKey]['handler']];
637 637
 
@@ -966,7 +966,7 @@  discard block
 block discarded – undo
966 966
      *
967 967
      * @param array|Closure|string $to
968 968
      */
969
-    public function match(array $verbs = [], string $from = '', $to = '', ?array $options = null): self
969
+    public function match(array $verbs = [], string $from = '', $to = '', ?array $options = null) : self
970 970
     {
971 971
         if (empty($from) || empty($to)) {
972 972
             throw new InvalidArgumentException('Vous devez fournir les paramètres : $from, $to.');
@@ -1150,7 +1150,7 @@  discard block
 block discarded – undo
1150 1150
                 $to = $route['handler'];
1151 1151
 
1152 1152
                 // on ignore les closures
1153
-                if (! is_string($to)) {
1153
+                if (!is_string($to)) {
1154 1154
                     continue;
1155 1155
                 }
1156 1156
 
@@ -1239,12 +1239,12 @@  discard block
 block discarded – undo
1239 1239
 
1240 1240
         // Construisez notre chaîne résultante, en insérant les $params aux endroits appropriés.
1241 1241
         foreach ($matches[0] as $index => $pattern) {
1242
-            if (! isset($params[$index])) {
1242
+            if (!isset($params[$index])) {
1243 1243
                 throw new InvalidArgumentException(
1244 1244
                     'Argument manquant pour "' . $pattern . '" dans la route "' . $routeKey . '".'
1245 1245
                 );
1246 1246
             }
1247
-            if (! preg_match('#^' . $pattern . '$#u', $params[$index])) {
1247
+            if (!preg_match('#^' . $pattern . '$#u', $params[$index])) {
1248 1248
                 throw RouterException::invalidParameterType();
1249 1249
             }
1250 1250
 
@@ -1322,9 +1322,9 @@  discard block
 block discarded – undo
1322 1322
         }
1323 1323
 
1324 1324
         // Limitation du nom d'hôte ?
1325
-        if (! empty($options['hostname'])) {
1325
+        if (!empty($options['hostname'])) {
1326 1326
             // @todo déterminer s'il existe un moyen de mettre les hôtes sur liste blanche ?
1327
-            if (! $this->checkHostname($options['hostname'])) {
1327
+            if (!$this->checkHostname($options['hostname'])) {
1328 1328
                 return;
1329 1329
             }
1330 1330
 
@@ -1332,10 +1332,10 @@  discard block
 block discarded – undo
1332 1332
         }
1333 1333
 
1334 1334
         // Limitation du nom sous-domaine ?
1335
-        elseif (! empty($options['subdomain'])) {
1335
+        elseif (!empty($options['subdomain'])) {
1336 1336
             // Si nous ne correspondons pas au sous-domaine actuel, alors
1337 1337
             // nous n'avons pas besoin d'ajouter la route.
1338
-            if (! $this->checkSubdomains($options['subdomain'])) {
1338
+            if (!$this->checkSubdomains($options['subdomain'])) {
1339 1339
                 return;
1340 1340
             }
1341 1341
 
@@ -1368,7 +1368,7 @@  discard block
 block discarded – undo
1368 1368
         }
1369 1369
 
1370 1370
         // S'il s'agit d'une redirection, aucun traitement
1371
-        if (! isset($options['redirect']) && is_string($to)) {
1371
+        if (!isset($options['redirect']) && is_string($to)) {
1372 1372
             // Si aucun espace de noms n'est trouvé, ajouter l'espace de noms par défaut
1373 1373
             if (strpos($to, '\\') === false || strpos($to, '\\') > 0) {
1374 1374
                 $namespace = $options['namespace'] ?? $this->defaultNamespace;
@@ -1387,7 +1387,7 @@  discard block
 block discarded – undo
1387 1387
         // cela ne fonctionne que parce que les routes découvertes sont ajoutées juste avant
1388 1388
         // pour tenter de router la requête.
1389 1389
         $routeKeyExists = isset($this->routes[$verb][$routeKey]);
1390
-        if ((isset($this->routesNames[$verb][$name]) || $routeKeyExists) && ! $overwrite) {
1390
+        if ((isset($this->routesNames[$verb][$name]) || $routeKeyExists) && !$overwrite) {
1391 1391
             return;
1392 1392
         }
1393 1393
 
@@ -1413,7 +1413,7 @@  discard block
 block discarded – undo
1413 1413
     private function checkHostname(string $hostname): bool
1414 1414
     {
1415 1415
         // Les appels CLI ne peuvent pas être sur le nom d'hôte.
1416
-        if (! isset($this->httpHost) || is_cli()) {
1416
+        if (!isset($this->httpHost) || is_cli()) {
1417 1417
             return false;
1418 1418
         }
1419 1419
 
@@ -1429,7 +1429,7 @@  discard block
 block discarded – undo
1429 1429
     private function checkSubdomains($subdomains): bool
1430 1430
     {
1431 1431
         // Les appels CLI ne peuvent pas être sur le sous-domaine.
1432
-        if (! isset($this->httpHost)) {
1432
+        if (!isset($this->httpHost)) {
1433 1433
             return false;
1434 1434
         }
1435 1435
 
@@ -1437,13 +1437,13 @@  discard block
 block discarded – undo
1437 1437
             $this->currentSubdomain = $this->determineCurrentSubdomain();
1438 1438
         }
1439 1439
 
1440
-        if (! is_array($subdomains)) {
1440
+        if (!is_array($subdomains)) {
1441 1441
             $subdomains = [$subdomains];
1442 1442
         }
1443 1443
 
1444 1444
         // Les routes peuvent être limitées à n'importe quel sous-domaine. Dans ce cas, cependant,
1445 1445
         // il nécessite la présence d'un sous-domaine.
1446
-        if (! empty($this->currentSubdomain) && in_array('*', $subdomains, true)) {
1446
+        if (!empty($this->currentSubdomain) && in_array('*', $subdomains, true)) {
1447 1447
             return true;
1448 1448
         }
1449 1449
 
@@ -1506,7 +1506,7 @@  discard block
 block discarded – undo
1506 1506
 
1507 1507
     private function getControllerName(Closure|string $handler): ?string
1508 1508
     {
1509
-        if (! is_string($handler)) {
1509
+        if (!is_string($handler)) {
1510 1510
             return null;
1511 1511
         }
1512 1512
 
@@ -1571,7 +1571,7 @@  discard block
 block discarded – undo
1571 1571
 
1572 1572
         // Vérifier les paramètres régionaux non valides
1573 1573
         if ($locale !== null) {
1574
-            if (! in_array($locale, config('app.supported_locales'), true)) {
1574
+            if (!in_array($locale, config('app.supported_locales'), true)) {
1575 1575
                 $locale = null;
1576 1576
             }
1577 1577
         }
Please login to merge, or discard this patch.
src/Router/Router.php 2 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -147,11 +147,11 @@  discard block
 block discarded – undo
147 147
                 $this->middlewaresInfo = $this->collection->getFiltersForRoute($this->matchedRoute[0]);
148 148
             }
149 149
 			
150
-			// met a jour le routeur dans le conteneur car permet notament de recupere les bonnes 
151
-			// info du routing (route actuelle, controleur et methode mappés)
152
-			Services::set(static::class, $this);
150
+            // met a jour le routeur dans le conteneur car permet notament de recupere les bonnes 
151
+            // info du routing (route actuelle, controleur et methode mappés)
152
+            Services::set(static::class, $this);
153 153
             
154
-			return $this->controllerName();
154
+            return $this->controllerName();
155 155
         }
156 156
 
157 157
         // Toujours là ? Ensuite, nous pouvons essayer de faire correspondre l'URI avec
@@ -163,9 +163,9 @@  discard block
 block discarded – undo
163 163
 
164 164
         $this->autoRoute($uri);
165 165
 
166
-		// met a jour le routeur dans le conteneur car permet notament de recupere les bonnes 
167
-		// info du routing (route actuelle, controleur et methode mappés)
168
-		Services::set(static::class, $this);
166
+        // met a jour le routeur dans le conteneur car permet notament de recupere les bonnes 
167
+        // info du routing (route actuelle, controleur et methode mappés)
168
+        Services::set(static::class, $this);
169 169
 
170 170
         return $this->controllerName();
171 171
     }
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
         // Toujours là ? Ensuite, nous pouvons essayer de faire correspondre l'URI avec
158 158
         // Contrôleurs/répertoires, mais l'application peut ne pas
159 159
         // vouloir ceci, comme dans le cas des API.
160
-        if (! $this->collection->shouldAutoRoute()) {
160
+        if (!$this->collection->shouldAutoRoute()) {
161 161
             throw new PageNotFoundException("Impossible de trouver une route pour '{$this->collection->getHTTPVerb()}: {$uri}'.");
162 162
         }
163 163
 
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
      */
188 188
     public function controllerName()
189 189
     {
190
-        if (! is_string($this->controller)) {
190
+        if (!is_string($this->controller)) {
191 191
             return $this->controller;
192 192
         }
193 193
 
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 
228 228
             return [
229 229
                 $routeArray[0], // Controller
230
-                $routeArray[1] ?? 'index',   // Method
230
+                $routeArray[1] ?? 'index', // Method
231 231
             ];
232 232
         }
233 233
 
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
                 // Cette route est-elle censée rediriger vers une autre ?
352 352
                 if ($this->collection->isRedirect($routeKey)) {
353 353
                     // remplacement des groupes de routes correspondants par des références : post/([0-9]+) -> post/$1
354
-                    $redirectTo = preg_replace_callback('/(\([^\(]+\))/', static function () {
354
+                    $redirectTo = preg_replace_callback('/(\([^\(]+\))/', static function() {
355 355
                         static $i = 1;
356 356
 
357 357
                         return '$' . $i++;
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
                     );
372 372
 
373 373
                     if ($this->collection->shouldUseSupportedLocalesOnly()
374
-                        && ! in_array($matched['locale'], config('App')->supportedLocales, true)) {
374
+                        && !in_array($matched['locale'], config('App')->supportedLocales, true)) {
375 375
                         // Lancer une exception pour empêcher l'autorouteur,
376 376
                         // si activé, essayer de trouver une route
377 377
                         throw PageNotFoundException::localeNotSupported($matched['locale']);
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
 
384 384
                 // Utilisons-nous Closures ? Si tel est le cas, nous devons collecter les paramètres dans un tableau
385 385
                 // afin qu'ils puissent être transmis ultérieurement à la méthode du contrôleur.
386
-                if (! is_string($handler) && is_callable($handler)) {
386
+                if (!is_string($handler) && is_callable($handler)) {
387 387
                     $this->controller = $handler;
388 388
 
389 389
                     // Supprime la chaîne d'origine du tableau matches
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
 
460 460
         // $this->method contient déjà le nom de la méthode par défaut,
461 461
         // donc ne l'écrasez pas avec le vide.
462
-        if (! empty($method)) {
462
+        if (!empty($method)) {
463 463
             $this->setMethod($method);
464 464
         }
465 465
 
Please login to merge, or discard this patch.
src/Router/Dispatcher.php 2 patches
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -124,8 +124,8 @@  discard block
 block discarded – undo
124 124
      * Chemin de requête à utiliser.
125 125
      *
126 126
      * @var string
127
-	 * 
128
-	 * @deprecated No longer used.
127
+     * 
128
+     * @deprecated No longer used.
129 129
      */
130 130
     protected $path;
131 131
 
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
      */
135 135
     protected int $bufferLevel = 0;
136 136
 
137
-	/**
137
+    /**
138 138
      * Web Page Caching
139 139
      */
140 140
     protected ResponseCache $pageCache;
@@ -147,9 +147,9 @@  discard block
 block discarded – undo
147 147
         $this->startTime = microtime(true);
148 148
         $this->config    = (object) config('app');
149 149
 
150
-		$this->pageCache = Services::factory(ResponseCache::class, [
151
-			'cacheQueryString' => config('cache.cache_query_string')
152
-		]);
150
+        $this->pageCache = Services::factory(ResponseCache::class, [
151
+            'cacheQueryString' => config('cache.cache_query_string')
152
+        ]);
153 153
     }
154 154
 
155 155
     /**
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
             $controller = $routes->getDefaultController();
180 180
         }
181 181
 
182
-		if (! $fullName && is_string($controller)) {
182
+        if (! $fullName && is_string($controller)) {
183 183
             $controller = str_replace($routes->getDefaultNamespace(), '', $controller);
184 184
         }
185 185
 
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
 
212 212
         $this->initMiddlewareQueue();
213 213
 
214
-		try {
214
+        try {
215 215
             $this->response = $this->handleRequest($routes, config('cache'));
216 216
         } catch (ResponsableInterface|RedirectException $e) {
217 217
             $this->outputBufferingEnd();
@@ -243,17 +243,17 @@  discard block
 block discarded – undo
243 243
      */
244 244
     protected function handleRequest(?RouteCollectionInterface $routes = null, ?array $cacheConfig = null): ResponseInterface
245 245
     {
246
-		$this->forceSecureAccess();
246
+        $this->forceSecureAccess();
247 247
 
248
-		/**
248
+        /**
249 249
          * Init event manager
250 250
          */
251
-		Services::singleton(EventDiscover::class)->discove();
251
+        Services::singleton(EventDiscover::class)->discove();
252 252
 
253
-		$this->event->trigger('pre_system');
253
+        $this->event->trigger('pre_system');
254 254
 
255
-		// Check for a cached page. 
256
-		// Execution will stop if the page has been cached.
255
+        // Check for a cached page. 
256
+        // Execution will stop if the page has been cached.
257 257
         if (($response = $this->displayCache($cacheConfig)) instanceof ResponseInterface) {
258 258
             return $response;
259 259
         }
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
         $routeMiddlewares = (array) $this->dispatchRoutes($routes);
262 262
 
263 263
         // Le bootstrap dans un middleware
264
-		$this->middleware->alias('blitz', $this->bootApp());
264
+        $this->middleware->alias('blitz', $this->bootApp());
265 265
         $this->middleware->append('blitz');
266 266
 
267 267
         /**
@@ -384,13 +384,13 @@  discard block
 block discarded – undo
384 384
      */
385 385
     public function displayCache(?array $config = null)
386 386
     {
387
-		if ($cachedResponse = $this->pageCache->get($this->request, $this->response)) {
387
+        if ($cachedResponse = $this->pageCache->get($this->request, $this->response)) {
388 388
             $this->response = $cachedResponse;
389 389
 
390 390
             $this->totalTime = $this->timer->getElapsedTime('total_execution');
391 391
             $output          = $this->displayPerformanceMetrics($cachedResponse->getBody());
392 392
         
393
-			return $this->response->withBody(to_stream($output));
393
+            return $this->response->withBody(to_stream($output));
394 394
         }
395 395
 
396 396
         return false;
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
 
590 590
             $this->gatherOutput($returned);
591 591
            
592
-			return $this->response;
592
+            return $this->response;
593 593
         }
594 594
 
595 595
         // Affiche l'erreur 404
@@ -659,13 +659,13 @@  discard block
 block discarded – undo
659 659
             $uri = Services::uri($uri, false);
660 660
         }
661 661
 
662
-		Services::session()->setPreviousUrl(Uri::createURIString(
663
-			$uri->getScheme(),
664
-			$uri->getAuthority(),
665
-			$uri->getPath(),
666
-			$uri->getQuery(),
667
-			$uri->getFragment()
668
-		));
662
+        Services::session()->setPreviousUrl(Uri::createURIString(
663
+            $uri->getScheme(),
664
+            $uri->getAuthority(),
665
+            $uri->getPath(),
666
+            $uri->getQuery(),
667
+            $uri->getFragment()
668
+        ));
669 669
     }
670 670
 
671 671
     /**
@@ -697,9 +697,9 @@  discard block
 block discarded – undo
697 697
             return $returned;
698 698
         }
699 699
 
700
-		if ($returned instanceof Responsable) {
701
-			return $returned->toResponse($this->request);
702
-		}
700
+        if ($returned instanceof Responsable) {
701
+            return $returned->toResponse($this->request);
702
+        }
703 703
 
704 704
         if (is_object($returned)) {
705 705
             if (method_exists($returned, '__toString')) {
@@ -747,11 +747,11 @@  discard block
 block discarded – undo
747 747
         $this->middleware->prepend($this->spoofRequestMethod());
748 748
     }
749 749
 
750
-	protected function outputBufferingStart(): void
750
+    protected function outputBufferingStart(): void
751 751
     {
752 752
         $this->bufferLevel = ob_get_level();
753 753
        
754
-		ob_start();
754
+        ob_start();
755 755
     }
756 756
 
757 757
     protected function outputBufferingEnd(): string
@@ -821,7 +821,7 @@  discard block
 block discarded – undo
821 821
                 }
822 822
 
823 823
                 if (is_string($this->controller)) {
824
-					if (strtoupper($request->getMethod()) === 'POST') {
824
+                    if (strtoupper($request->getMethod()) === 'POST') {
825 825
                         if (is_subclass_of($this->controller, RestController::class)) {
826 826
                             return $this->formatResponse($response->withStatus($code), [
827 827
                                 'success' => false,
@@ -829,7 +829,7 @@  discard block
 block discarded – undo
829 829
                                 'errors'  => $errors,
830 830
                             ]);
831 831
                         }
832
-						if (is_subclass_of($this->controller, BaseController::class)) {
832
+                        if (is_subclass_of($this->controller, BaseController::class)) {
833 833
                             return Services::redirection()->back()->withInput()->withErrors($errors)->withStatus($code);
834 834
                         }
835 835
                     }
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
             $controller = $routes->getDefaultController();
180 180
         }
181 181
 
182
-		if (! $fullName && is_string($controller)) {
182
+		if (!$fullName && is_string($controller)) {
183 183
             $controller = str_replace($routes->getDefaultNamespace(), '', $controller);
184 184
         }
185 185
 
@@ -324,14 +324,14 @@  discard block
 block discarded – undo
324 324
             return;
325 325
         }
326 326
 
327
-        if (is_cli() && ! on_test()) {
327
+        if (is_cli() && !on_test()) {
328 328
             // @codeCoverageIgnoreStart
329 329
             // $this->request = Services::clirequest($this->config);
330 330
             // @codeCoverageIgnoreEnd
331 331
         }
332 332
 
333 333
         $version = $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.1';
334
-        if (! is_numeric($version)) {
334
+        if (!is_numeric($version)) {
335 335
             $version = substr($version, strpos($version, '/') + 1);
336 336
         }
337 337
 
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
         // Supposons le succès jusqu'à preuve du contraire.
351 351
         $this->response = Services::response()->withStatus(200);
352 352
 
353
-        if (! is_cli() || on_test()) {
353
+        if (!is_cli() || on_test()) {
354 354
         }
355 355
 
356 356
         $this->response = $this->response->withProtocolVersion($this->request->getProtocolVersion());
@@ -464,7 +464,7 @@  discard block
 block discarded – undo
464 464
      */
465 465
     protected function determinePath(): string
466 466
     {
467
-        if (! empty($this->path)) {
467
+        if (!empty($this->path)) {
468 468
             return $this->path;
469 469
         }
470 470
 
@@ -505,7 +505,7 @@  discard block
 block discarded – undo
505 505
         }
506 506
 
507 507
         // Essayez de charger automatiquement la classe
508
-        if (! class_exists($this->controller, true) || ($this->method[0] === '_' && $this->method !== '__invoke')) {
508
+        if (!class_exists($this->controller, true) || ($this->method[0] === '_' && $this->method !== '__invoke')) {
509 509
             throw PageNotFoundException::controllerNotFound($this->controller, $this->method);
510 510
         }
511 511
 
@@ -598,7 +598,7 @@  discard block
 block discarded – undo
598 598
         echo $this->outputBufferingEnd();
599 599
         flush();
600 600
 
601
-        throw PageNotFoundException::pageNotFound(! on_prod() || is_cli() ? $e->getMessage() : '');
601
+        throw PageNotFoundException::pageNotFound(!on_prod() || is_cli() ? $e->getMessage() : '');
602 602
     }
603 603
 
604 604
     /**
@@ -640,7 +640,7 @@  discard block
 block discarded – undo
640 640
     public function storePreviousURL($uri)
641 641
     {
642 642
         // Ignorer les requêtes CLI
643
-        if (is_cli() && ! on_test()) {
643
+        if (is_cli() && !on_test()) {
644 644
             return; // @codeCoverageIgnore
645 645
         }
646 646
 
@@ -737,7 +737,7 @@  discard block
 block discarded – undo
737 737
         ]);
738 738
 
739 739
         $middlewaresFile = CONFIG_PATH . 'middlewares.php';
740
-        if (file_exists($middlewaresFile) && ! in_array($middlewaresFile, get_included_files(), true)) {
740
+        if (file_exists($middlewaresFile) && !in_array($middlewaresFile, get_included_files(), true)) {
741 741
             $middleware = require $middlewaresFile;
742 742
             if (is_callable($middleware)) {
743 743
                 $middleware($this->middleware, $this->request);
@@ -772,11 +772,11 @@  discard block
 block discarded – undo
772 772
      */
773 773
     private function spoofRequestMethod(): callable
774 774
     {
775
-        return static function (ServerRequestInterface $request, ResponseInterface $response, callable $next) {
775
+        return static function(ServerRequestInterface $request, ResponseInterface $response, callable $next) {
776 776
             $post = $request->getParsedBody();
777 777
 
778 778
             // Ne fonctionne qu'avec les formulaires POST
779
-            if (strtoupper($request->getMethod()) === 'POST' && ! empty($post['_method'])) {
779
+            if (strtoupper($request->getMethod()) === 'POST' && !empty($post['_method'])) {
780 780
                 // Accepte seulement PUT, PATCH, DELETE
781 781
                 if (in_array(strtoupper($post['_method']), ['PUT', 'PATCH', 'DELETE'], true)) {
782 782
                     $request = $request->withMethod($post['_method']);
@@ -789,15 +789,15 @@  discard block
 block discarded – undo
789 789
 
790 790
     private function bootApp(): callable
791 791
     {
792
-        return function (ServerRequestInterface $request, ResponseInterface $response, callable $next): ResponseInterface {
792
+        return function(ServerRequestInterface $request, ResponseInterface $response, callable $next): ResponseInterface {
793 793
             try {
794 794
                 $returned = $this->startController($request, $response);
795 795
 
796 796
                 // Closure controller has run in startController().
797
-                if (! is_callable($this->controller)) {
797
+                if (!is_callable($this->controller)) {
798 798
                     $controller = $this->createController($request, $response);
799 799
 
800
-                    if (! method_exists($controller, '_remap') && ! is_callable([$controller, $this->method], false)) {
800
+                    if (!method_exists($controller, '_remap') && !is_callable([$controller, $this->method], false)) {
801 801
                         throw PageNotFoundException::methodNotFound($this->method);
802 802
                     }
803 803
 
Please login to merge, or discard this patch.
src/Router/AutoRouter.php 2 patches
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -63,19 +63,19 @@  discard block
 block discarded – undo
63 63
 
64 64
     /**
65 65
      * Position du contrôleur dans les segments URI. 
66
-	 * Null pour le contrôleur par défaut. 
66
+     * Null pour le contrôleur par défaut. 
67 67
      */
68 68
     private ?int $controllerPos = null;
69 69
 
70 70
     /**
71 71
      * Position de la méthode dans les segments URI. 
72
-	 * Null pour la méthode par défaut. 
72
+     * Null pour la méthode par défaut. 
73 73
      */
74 74
     private ?int $methodPos = null;
75 75
 
76 76
     /**
77 77
      * Position du premier Paramètre dans les segments URI. 
78
-	 * Null pour les paramètres non definis. 
78
+     * Null pour les paramètres non definis. 
79 79
      */
80 80
     private ?int $paramPos = null;
81 81
 
@@ -95,9 +95,9 @@  discard block
 block discarded – undo
95 95
         private string $defaultMethod,
96 96
         private bool $translateURIDashes
97 97
     ) {
98
-		$this->namespace = rtrim($namespace, '\\');
98
+        $this->namespace = rtrim($namespace, '\\');
99 99
         
100
-		// Definir les valeurs par defaut
100
+        // Definir les valeurs par defaut
101 101
         $this->controller = $this->defaultController;
102 102
     }
103 103
 
@@ -114,8 +114,8 @@  discard block
 block discarded – undo
114 114
      * Recherchez le premier contrôleur correspondant au segment URI.
115 115
      *
116 116
      * S'il y a un contrôleur correspondant au premier segment, la recherche s'arrête là. 
117
-	 * Les segments restants sont des paramètres du contrôleur. 
118
-	 * 
117
+     * Les segments restants sont des paramètres du contrôleur. 
118
+     * 
119 119
      * @return bool true si une classe de contrôleur est trouvée.
120 120
      */
121 121
     private function searchFirstController(): bool
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
         return false;
157 157
     }
158 158
 
159
-	/**
159
+    /**
160 160
      * Recherchez le dernier contrôleur par défaut correspondant aux segments URI.
161 161
      *
162 162
      * @return bool true si une classe de contrôleur est trouvée.
@@ -216,16 +216,16 @@  discard block
 block discarded – undo
216 216
         return false;
217 217
     }
218 218
 
219
-	/**
219
+    /**
220 220
      * Recherche contrôleur, méthode et params dans l'URI.
221 221
      *
222 222
      * @return array [directory_name, controller_name, controller_method, params]
223 223
      */
224 224
     public function getRoute(string $uri, string $httpVerb): array
225 225
     {
226
-		$httpVerb = strtolower($httpVerb);
226
+        $httpVerb = strtolower($httpVerb);
227 227
 
228
-		// Reinitialise les parametres de la methode du controleur.
228
+        // Reinitialise les parametres de la methode du controleur.
229 229
         $this->params = [];
230 230
 
231 231
         $defaultMethod = $httpVerb . ucfirst($this->defaultMethod);
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 
234 234
         $this->segments = $this->createSegments($uri);
235 235
 
236
-		//Verifier les routes de modules
236
+        //Verifier les routes de modules
237 237
         if (
238 238
             $this->segments !== []
239 239
             && ($routingConfig = (object) config('routing'))
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
             $this->namespace = rtrim($routingConfig->module_routes[$uriSegment], '\\');
244 244
         }
245 245
 
246
-		if ($this->searchFirstController()) {
246
+        if ($this->searchFirstController()) {
247 247
             // Le contrôleur a ete trouvé.
248 248
             $baseControllerName = Helpers::classBasename($this->controller);
249 249
 
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
             throw new PageNotFoundException('Aucun contrôleur trouvé pour: ' . $uri);
262 262
         }
263 263
 
264
-		// Le premier élément peut être un nom de méthode.
264
+        // Le premier élément peut être un nom de méthode.
265 265
         /** @var string[] $params */
266 266
         $params = $this->params;
267 267
 
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
             $method = $httpVerb . ucfirst($this->translateURIDashes($methodParam));
273 273
         }
274 274
 
275
-		if ($methodParam !== null && method_exists($this->controller, $method)) {
275
+        if ($methodParam !== null && method_exists($this->controller, $method)) {
276 276
             // Methode trouvee.
277 277
             $this->method = $method;
278 278
             $this->params = $params;
@@ -307,14 +307,14 @@  discard block
 block discarded – undo
307 307
             throw PageNotFoundException::controllerNotFound($this->controller, $method);
308 308
         }
309 309
 
310
-		// Vérifiez le contrôleur n'est pas défini dans les routes.
310
+        // Vérifiez le contrôleur n'est pas défini dans les routes.
311 311
         $this->protectDefinedRoutes();
312 312
 
313 313
         // Assurez-vous que le contrôleur n'a pas la méthode _remap().
314 314
         $this->checkRemap();
315 315
 
316 316
         // Assurez-vous que les segments URI pour le contrôleur et la méthode 
317
-		// ne contiennent pas de soulignement lorsque $translateURIDashes est true.
317
+        // ne contiennent pas de soulignement lorsque $translateURIDashes est true.
318 318
         $this->checkUnderscore($uri);
319 319
 
320 320
         // Verifier le nombre de parametres
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
 
327 327
         $this->setDirectory();
328 328
         
329
-		return [$this->directory, $this->controllerName(), $this->methodName(), $this->params];
329
+        return [$this->directory, $this->controllerName(), $this->methodName(), $this->params];
330 330
     }
331 331
 
332 332
     private function checkParameters(string $uri): void
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
         }
435 435
     }
436 436
 
437
-	private function protectDefinedRoutes(): void
437
+    private function protectDefinedRoutes(): void
438 438
     {
439 439
         $controller = strtolower($this->controller);
440 440
 
@@ -452,8 +452,8 @@  discard block
 block discarded – undo
452 452
     /**
453 453
      * Renvoie le nom du sous-répertoire dans lequel se trouve le contrôleur.
454 454
      * Relatif à CONTROLLER_PATH
455
-	 * 
456
-	 * @deprecated 1.0
455
+     * 
456
+     * @deprecated 1.0
457 457
      */
458 458
     public function directory(): string
459 459
     {
@@ -488,8 +488,8 @@  discard block
 block discarded – undo
488 488
 
489 489
     /**
490 490
      * Construit un nom de contrôleur valide
491
-	 * 
492
-	 * @deprecated 1.0
491
+     * 
492
+     * @deprecated 1.0
493 493
      */
494 494
     public function makeController(string $name): string
495 495
     {
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
             $class = $this->translateURIDashes(ucfirst($segment));
134 134
 
135 135
             // dès que nous rencontrons un segment qui n'est pas compatible PSR-4, arrêter la recherche
136
-            if (! $this->isValidSegment($class)) {
136
+            if (!$this->isValidSegment($class)) {
137 137
                 return false;
138 138
             }
139 139
 
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
             throw new MethodNotFoundException();
345 345
         }
346 346
 
347
-        if (! $refMethod->isPublic()) {
347
+        if (!$refMethod->isPublic()) {
348 348
             throw new MethodNotFoundException();
349 349
         }
350 350
 
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
      */
458 458
     public function directory(): string
459 459
     {
460
-        return ! empty($this->directory) ? $this->directory : '';
460
+        return !empty($this->directory) ? $this->directory : '';
461 461
     }
462 462
 
463 463
     /**
@@ -467,7 +467,7 @@  discard block
 block discarded – undo
467 467
      */
468 468
     private function controllerName()
469 469
     {
470
-        if (! is_string($this->controller)) {
470
+        if (!is_string($this->controller)) {
471 471
             return $this->controller;
472 472
         }
473 473
 
Please login to merge, or discard this patch.
src/Cli/Commands/Routes/AutoRouteCollector.php 2 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -20,17 +20,17 @@  discard block
 block discarded – undo
20 20
 {
21 21
     /**
22 22
      * @param string $namespace Namespace dans lequel on recherche
23
-	 * @param array<class-string> $protectedControllers Liste des contrôleurs dans les routes définis qui ne doivent pas être consultés via Auto-Routing.
24
-	 * @param string $prefix Préfixe URI pour Module Routing
23
+     * @param array<class-string> $protectedControllers Liste des contrôleurs dans les routes définis qui ne doivent pas être consultés via Auto-Routing.
24
+     * @param string $prefix Préfixe URI pour Module Routing
25 25
      */
26 26
     public function __construct(
27
-		private string $namespace, 
28
-		private string $defaultController, 
29
-		private string $defaultMethod,
30
-		private array $httpMethods,
27
+        private string $namespace, 
28
+        private string $defaultController, 
29
+        private string $defaultMethod,
30
+        private array $httpMethods,
31 31
         private array $protectedControllers,
32 32
         private string $prefix = ''
33
-	)
33
+    )
34 34
     {
35 35
     }
36 36
 
@@ -51,17 +51,17 @@  discard block
 block discarded – undo
51 51
                 continue;
52 52
             }
53 53
 			
54
-			$routes = $reader->read(
54
+            $routes = $reader->read(
55 55
                 $class,
56 56
                 $this->defaultController,
57 57
                 $this->defaultMethod
58 58
             );
59 59
 
60
-			if ($routes === []) {
60
+            if ($routes === []) {
61 61
                 continue;
62 62
             }
63 63
 
64
-			$routes = $this->addMiddlewares($routes);
64
+            $routes = $this->addMiddlewares($routes);
65 65
 
66 66
             foreach ($routes as $item) {
67 67
                 $route = $item['route'] . $item['route_params'];
@@ -73,12 +73,12 @@  discard block
 block discarded – undo
73 73
                     $route = $this->prefix . '/' . $route;
74 74
                 }
75 75
 				
76
-				$tbody[] = [
76
+                $tbody[] = [
77 77
                     strtoupper($item['method']) . '(auto)',
78 78
                     $route,
79 79
                     '',
80 80
                     $item['handler'],
81
-					'',
81
+                    '',
82 82
                 ];
83 83
             }
84 84
         }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -125,7 +125,7 @@
 block discarded – undo
125 125
             $i = 1;
126 126
 
127 127
             foreach ($route['params'] as $required) {
128
-                if ($longest && ! $required) {
128
+                if ($longest && !$required) {
129 129
                     $sampleUri .= '/' . $i++;
130 130
                 }
131 131
             }
Please login to merge, or discard this patch.
src/Cli/Commands/Routes/ControllerMethodReader.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
         foreach ($reflection->getMethods(ReflectionMethod::IS_PUBLIC) as $method) {
50 50
             $methodName = $method->getName();
51 51
 
52
-			foreach ($this->httpMethods as $httpVerb) {
52
+            foreach ($this->httpMethods as $httpVerb) {
53 53
                 if (strpos($methodName, $httpVerb) === 0) {
54 54
                     // Enleve le prefixe des verbes HTTP
55 55
                     $methodInUri = lcfirst(substr($methodName, strlen($httpVerb)));
@@ -68,8 +68,8 @@  discard block
 block discarded – undo
68 68
 
69 69
                         if ($routeForDefaultController !== []) {
70 70
                             // Le contrôleur est le contrôleur par défaut. 
71
-							// Il n'a qu'un itinéraire pour la méthode par défaut. 
72
-							// Les autres méthodes ne seront pas routées même si elles existent. 
71
+                            // Il n'a qu'un itinéraire pour la méthode par défaut. 
72
+                            // Les autres méthodes ne seront pas routées même si elles existent. 
73 73
                             $output = [...$output, ...$routeForDefaultController];
74 74
 
75 75
                             continue;
Please login to merge, or discard this patch.
src/Cli/Commands/Routes/Routes.php 2 patches
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -49,8 +49,8 @@  discard block
 block discarded – undo
49 49
      * @var array<string, string>
50 50
      */
51 51
     protected $options = [
52
-		'-h'     => 'Trier par gestionnaire.',
53
-		'--host' => 'Spécifiez nom d\'hôte dans la demande URI.',
52
+        '-h'     => 'Trier par gestionnaire.',
53
+        '--host' => 'Spécifiez nom d\'hôte dans la demande URI.',
54 54
     ];
55 55
 
56 56
     /**
@@ -75,14 +75,14 @@  discard block
 block discarded – undo
75 75
             'cli',
76 76
         ];
77 77
 
78
-		$tbody                 = [];
79
-		$uriGenerator          = new SampleURIGenerator($collection);
80
-		$middlewareCollector   = new MiddlewareCollector();
81
-		$definedRouteCollector = new DefinedRouteCollector($collection);
78
+        $tbody                 = [];
79
+        $uriGenerator          = new SampleURIGenerator($collection);
80
+        $middlewareCollector   = new MiddlewareCollector();
81
+        $definedRouteCollector = new DefinedRouteCollector($collection);
82 82
 
83
-		foreach ($definedRouteCollector->collect() as $route) {
83
+        foreach ($definedRouteCollector->collect() as $route) {
84 84
             $sampleUri = $uriGenerator->get($route['route']);
85
-			$filters   = $middlewareCollector->get($route['method'], $sampleUri);
85
+            $filters   = $middlewareCollector->get($route['method'], $sampleUri);
86 86
 
87 87
             $routeName = ($route['route'] === $route['name']) ? '»' : $route['name'];
88 88
 
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
                 $route['route'],
92 92
                 $routeName,
93 93
                 $route['handler'],
94
-				implode(' ', array_map([Helpers::class, 'classBasename'], $filters)),
94
+                implode(' ', array_map([Helpers::class, 'classBasename'], $filters)),
95 95
             ];
96 96
         }
97 97
 
@@ -100,27 +100,27 @@  discard block
 block discarded – undo
100 100
                 $collection->getDefaultNamespace(),
101 101
                 $collection->getDefaultController(),
102 102
                 $collection->getDefaultMethod(),
103
-				$methods,
104
-				$collection->getRegisteredControllers('*')
103
+                $methods,
104
+                $collection->getRegisteredControllers('*')
105 105
             );
106 106
 
107 107
             $autoRoutes = $autoRouteCollector->get();
108 108
 
109
-			// Check for Module Routes.
110
-			if ([] !== $routingConfig = config('routing')) {
111
-				foreach ($routingConfig['module_routes'] as $uri => $namespace) {
112
-					$autoRouteCollector = new AutoRouteCollector(
113
-						$namespace,
114
-						$collection->getDefaultController(),
115
-						$collection->getDefaultMethod(),
116
-						$methods,
117
-						$collection->getRegisteredControllers('*'),
118
-						$uri
119
-					);
120
-
121
-					$autoRoutes = [...$autoRoutes, ...$autoRouteCollector->get()];
122
-				}
123
-			}
109
+            // Check for Module Routes.
110
+            if ([] !== $routingConfig = config('routing')) {
111
+                foreach ($routingConfig['module_routes'] as $uri => $namespace) {
112
+                    $autoRouteCollector = new AutoRouteCollector(
113
+                        $namespace,
114
+                        $collection->getDefaultController(),
115
+                        $collection->getDefaultMethod(),
116
+                        $methods,
117
+                        $collection->getRegisteredControllers('*'),
118
+                        $uri
119
+                    );
120
+
121
+                    $autoRoutes = [...$autoRoutes, ...$autoRouteCollector->get()];
122
+                }
123
+            }
124 124
 
125 125
             $tbody = [...$tbody, ...$autoRoutes];
126 126
         }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -82,7 +82,7 @@
 block discarded – undo
82 82
 
83 83
 		foreach ($definedRouteCollector->collect() as $route) {
84 84
             $sampleUri = $uriGenerator->get($route['route']);
85
-			$filters   = $middlewareCollector->get($route['method'], $sampleUri);
85
+			$filters = $middlewareCollector->get($route['method'], $sampleUri);
86 86
 
87 87
             $routeName = ($route['route'] === $route['name']) ? '»' : $route['name'];
88 88
 
Please login to merge, or discard this patch.