@@ -147,11 +147,11 @@ discard block |
||
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 |
||
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 | } |
@@ -157,7 +157,7 @@ discard block |
||
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,11 +187,11 @@ discard block |
||
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 | |
194 | - $controller = str_contains($this->controller, '\\') |
|
194 | + $controller = str_contains($this->controller, '\\') |
|
195 | 195 | ? $this->controller |
196 | 196 | : trim($this->collection->getDefaultNamespace(), '\\') . '\\' . $this->controller; |
197 | 197 | |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | |
232 | 232 | return [ |
233 | 233 | $routeArray[0], // Controller |
234 | - $routeArray[1] ?? 'index', // Method |
|
234 | + $routeArray[1] ?? 'index', // Method |
|
235 | 235 | ]; |
236 | 236 | } |
237 | 237 | |
@@ -355,7 +355,7 @@ discard block |
||
355 | 355 | // Cette route est-elle censée rediriger vers une autre ? |
356 | 356 | if ($this->collection->isRedirect($routeKey)) { |
357 | 357 | // remplacement des groupes de routes correspondants par des références : post/([0-9]+) -> post/$1 |
358 | - $redirectTo = preg_replace_callback('/(\([^\(]+\))/', static function () { |
|
358 | + $redirectTo = preg_replace_callback('/(\([^\(]+\))/', static function() { |
|
359 | 359 | static $i = 1; |
360 | 360 | |
361 | 361 | return '$' . $i++; |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | ); |
376 | 376 | |
377 | 377 | if ($this->collection->shouldUseSupportedLocalesOnly() |
378 | - && ! in_array($matched['locale'], config('App')->supportedLocales, true)) { |
|
378 | + && !in_array($matched['locale'], config('App')->supportedLocales, true)) { |
|
379 | 379 | // Lancer une exception pour empêcher l'autorouteur, |
380 | 380 | // si activé, essayer de trouver une route |
381 | 381 | throw PageNotFoundException::localeNotSupported($matched['locale']); |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | |
388 | 388 | // Utilisons-nous Closures ? Si tel est le cas, nous devons collecter les paramètres dans un tableau |
389 | 389 | // afin qu'ils puissent être transmis ultérieurement à la méthode du contrôleur. |
390 | - if (! is_string($handler) && is_callable($handler)) { |
|
390 | + if (!is_string($handler) && is_callable($handler)) { |
|
391 | 391 | $this->controller = $handler; |
392 | 392 | |
393 | 393 | // Supprime la chaîne d'origine du tableau matches |
@@ -463,7 +463,7 @@ discard block |
||
463 | 463 | |
464 | 464 | // $this->method contient déjà le nom de la méthode par défaut, |
465 | 465 | // donc ne l'écrasez pas avec le vide. |
466 | - if (! empty($method)) { |
|
466 | + if (!empty($method)) { |
|
467 | 467 | $this->setMethod($method); |
468 | 468 | } |
469 | 469 |
@@ -63,19 +63,19 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | { |
@@ -133,7 +133,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
@@ -20,17 +20,17 @@ discard block |
||
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 |
||
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 |
||
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 | } |
@@ -125,7 +125,7 @@ |
||
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 | } |
@@ -49,7 +49,7 @@ discard block |
||
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 |
||
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; |
@@ -49,8 +49,8 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -82,7 +82,7 @@ |
||
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 |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | |
46 | 46 | /** |
47 | 47 | * Valeurs autorisées pour l'environnement. |
48 | - * Tester le travail est exclu puisque klinge ne fonctionnera pas sur elle. |
|
48 | + * Tester le travail est exclu puisque klinge ne fonctionnera pas sur elle. |
|
49 | 49 | * |
50 | 50 | * @var array<int, string> |
51 | 51 | */ |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | { |
62 | 62 | if (null === $env = $this->argument('environment')) { |
63 | 63 | $this->write('Votre environnement est actuellement défini comme: '); |
64 | - $this->ok(config('app.environment'))->eol(); |
|
64 | + $this->ok(config('app.environment'))->eol(); |
|
65 | 65 | |
66 | 66 | return; |
67 | 67 | } |
@@ -113,6 +113,6 @@ discard block |
||
113 | 113 | copy($baseEnv, $envFile); |
114 | 114 | } |
115 | 115 | |
116 | - return DotEnv::instance()->replace(['ENVIRONMENT' => $newEnv]); |
|
116 | + return DotEnv::instance()->replace(['ENVIRONMENT' => $newEnv]); |
|
117 | 117 | } |
118 | 118 | } |
@@ -74,14 +74,14 @@ discard block |
||
74 | 74 | return; |
75 | 75 | } |
76 | 76 | |
77 | - if (! in_array($env, self::$knownTypes, true)) { |
|
77 | + if (!in_array($env, self::$knownTypes, true)) { |
|
78 | 78 | $this->error(sprintf('Type d\'environnement non valide "%s". Attendu un des "%s".', $env, implode('" et "', self::$knownTypes))); |
79 | 79 | $this->newLine(); |
80 | 80 | |
81 | 81 | return; |
82 | 82 | } |
83 | 83 | |
84 | - if (! $this->writeNewEnvironmentToEnvFile($env)) { |
|
84 | + if (!$this->writeNewEnvironmentToEnvFile($env)) { |
|
85 | 85 | $this->error('Erreur dans l\'écriture nouvel environnement dans le fichier `.env`.'); |
86 | 86 | $this->newLine(); |
87 | 87 | |
@@ -101,8 +101,8 @@ discard block |
||
101 | 101 | $baseEnv = ROOTPATH . '.env.example'; |
102 | 102 | $envFile = ROOTPATH . '.env'; |
103 | 103 | |
104 | - if (! is_file($envFile)) { |
|
105 | - if (! is_file($baseEnv)) { |
|
104 | + if (!is_file($envFile)) { |
|
105 | + if (!is_file($baseEnv)) { |
|
106 | 106 | $this->writer->warn('Les deux fichiers `.env.example` et `.env` sont manquants.', true); |
107 | 107 | $this->write('Il est impossible d\'écrire le nouveau type d\'environnement.'); |
108 | 108 | $this->newLine(); |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | */ |
26 | 26 | protected $group = 'BlitzPHP'; |
27 | 27 | |
28 | - /** |
|
28 | + /** |
|
29 | 29 | * @var string Nom |
30 | 30 | */ |
31 | 31 | protected $name = 'namespaces'; |
@@ -52,20 +52,20 @@ discard block |
||
52 | 52 | $m = (int) $this->option('m', 60); |
53 | 53 | |
54 | 54 | $tbody = true === $this->option('b') |
55 | - ? $this->outputBlitzNamespaces($m) |
|
56 | - : $this->outputAllNamespaces($m); |
|
55 | + ? $this->outputBlitzNamespaces($m) |
|
56 | + : $this->outputAllNamespaces($m); |
|
57 | 57 | |
58 | - $table = []; |
|
58 | + $table = []; |
|
59 | 59 | |
60 | - foreach ($tbody as $namespace) { |
|
61 | - $table[] = [ |
|
62 | - 'Namespace' => $namespace[0], |
|
63 | - 'Chemin' => $namespace[1], |
|
64 | - 'Trouvé?' => $namespace[2] ? 'Oui' : 'Manque', |
|
65 | - ]; |
|
66 | - } |
|
60 | + foreach ($tbody as $namespace) { |
|
61 | + $table[] = [ |
|
62 | + 'Namespace' => $namespace[0], |
|
63 | + 'Chemin' => $namespace[1], |
|
64 | + 'Trouvé?' => $namespace[2] ? 'Oui' : 'Manque', |
|
65 | + ]; |
|
66 | + } |
|
67 | 67 | |
68 | - $this->table($table); |
|
68 | + $this->table($table); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | private function outputAllNamespaces(int $maxLength): array |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | */ |
51 | 51 | public function execute(array $params) |
52 | 52 | { |
53 | - $method = strtolower($this->argument('method', '')); |
|
53 | + $method = strtolower($this->argument('method', '')); |
|
54 | 54 | $route = $this->argument('route', ''); |
55 | 55 | |
56 | 56 | if (empty($route) || empty($method)) { |
@@ -72,18 +72,18 @@ discard block |
||
72 | 72 | // PageNotFoundException |
73 | 73 | if ($middlewares === ['<unknown>']) { |
74 | 74 | $this->fail("Impossible de trouver une route: ") . |
75 | - $this->colorize('"' . strtoupper($method) . ' ' . $route . '"', 'black'); |
|
75 | + $this->colorize('"' . strtoupper($method) . ' ' . $route . '"', 'black'); |
|
76 | 76 | |
77 | 77 | return EXIT_ERROR; |
78 | 78 | } |
79 | 79 | |
80 | - $this->table([ |
|
81 | - [ |
|
82 | - 'Methode' => strtoupper($method), |
|
83 | - 'Route' => $route, |
|
84 | - 'Middlewares' => implode(' ', $middlewares), |
|
85 | - ] |
|
86 | - ]); |
|
80 | + $this->table([ |
|
81 | + [ |
|
82 | + 'Methode' => strtoupper($method), |
|
83 | + 'Route' => $route, |
|
84 | + 'Middlewares' => implode(' ', $middlewares), |
|
85 | + ] |
|
86 | + ]); |
|
87 | 87 | |
88 | 88 | return EXIT_SUCCESS; |
89 | 89 | } |
@@ -51,7 +51,7 @@ |
||
51 | 51 | public function execute(array $params) |
52 | 52 | { |
53 | 53 | $method = strtolower($this->argument('method', '')); |
54 | - $route = $this->argument('route', ''); |
|
54 | + $route = $this->argument('route', ''); |
|
55 | 55 | |
56 | 56 | if (empty($route) || empty($method)) { |
57 | 57 | $this->fail('Vous devez spécifier un verbe HTTP et une route.')->eol(); |
@@ -143,6 +143,6 @@ |
||
143 | 143 | copy($baseEnv, $envFile); |
144 | 144 | } |
145 | 145 | |
146 | - return DotEnv::instance()->replace(['encryption.key' => $key]); |
|
146 | + return DotEnv::instance()->replace(['encryption.key' => $key]); |
|
147 | 147 | } |
148 | 148 | } |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | |
59 | 59 | if (in_array($prefix, [null, true], true)) { |
60 | 60 | $prefix = 'hex2bin'; |
61 | - } elseif (! in_array($prefix, ['hex2bin', 'base64'], true)) { |
|
61 | + } elseif (!in_array($prefix, ['hex2bin', 'base64'], true)) { |
|
62 | 62 | $prefix = $this->choice('Veuillez utiliser un prefixe validee.', ['hex2bin', 'base64']); // @codeCoverageIgnore |
63 | 63 | } |
64 | 64 | |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | return; |
79 | 79 | } |
80 | 80 | |
81 | - if (! $this->setNewEncryptionKey($encodedKey)) { |
|
81 | + if (!$this->setNewEncryptionKey($encodedKey)) { |
|
82 | 82 | $this->writer->error('Erreur dans la configuration d\'une nouvelle cle d\'encryption dans le fichier `.env`.', true); |
83 | 83 | |
84 | 84 | return; |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | { |
109 | 109 | $currentKey = env('encryption.key', ''); |
110 | 110 | |
111 | - if ($currentKey !== '' && ! $this->confirmOverwrite()) { |
|
111 | + if ($currentKey !== '' && !$this->confirmOverwrite()) { |
|
112 | 112 | // Pas testable car require une entree au clavier |
113 | 113 | return false; // @codeCoverageIgnore |
114 | 114 | } |
@@ -132,8 +132,8 @@ discard block |
||
132 | 132 | $baseEnv = ROOTPATH . '.env.example'; |
133 | 133 | $envFile = ROOTPATH . '.env'; |
134 | 134 | |
135 | - if (! is_file($envFile)) { |
|
136 | - if (! is_file($baseEnv)) { |
|
135 | + if (!is_file($envFile)) { |
|
136 | + if (!is_file($baseEnv)) { |
|
137 | 137 | $this->writer->warn('Both default shipped `.env.example` file and custom `.env` are missing.'); |
138 | 138 | $this->write('Here\'s your new key instead: ' . $this->writer->warn($key), true); |
139 | 139 |