@@ -98,7 +98,7 @@ |
||
98 | 98 | return $this->withFile($filepath, ['download' => true, 'name' => $filename]); |
99 | 99 | } |
100 | 100 | |
101 | - if (! empty($data)) { |
|
101 | + if (!empty($data)) { |
|
102 | 102 | return $this->withStringBody($data) |
103 | 103 | ->withType(pathinfo($filename, PATHINFO_EXTENSION)) |
104 | 104 | ->withDownload($filename); |
@@ -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,7 +187,7 @@ 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 | |
@@ -227,7 +227,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function exists(string $key): bool |
45 | 45 | { |
46 | - if (! $this->configurator->exists($key)) { |
|
46 | + if (!$this->configurator->exists($key)) { |
|
47 | 47 | $config = explode('.', $key); |
48 | 48 | $this->load($config[0]); |
49 | 49 | |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | */ |
67 | 67 | public function missing(string $key): bool |
68 | 68 | { |
69 | - return ! $this->exists($key); |
|
69 | + return !$this->exists($key); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | /** |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | { |
109 | 109 | if (is_array($config)) { |
110 | 110 | foreach ($config as $key => $value) { |
111 | - if (! is_string($value) || empty($value)) { |
|
111 | + if (!is_string($value) || empty($value)) { |
|
112 | 112 | continue; |
113 | 113 | } |
114 | 114 | if (is_string($key)) { |
@@ -120,13 +120,13 @@ discard block |
||
120 | 120 | } |
121 | 121 | self::load($conf, $file); |
122 | 122 | } |
123 | - } elseif (is_string($config) && ! isset(self::$loaded[$config])) { |
|
123 | + } elseif (is_string($config) && !isset(self::$loaded[$config])) { |
|
124 | 124 | if (empty($file)) { |
125 | 125 | $file = self::path($config); |
126 | 126 | } |
127 | 127 | |
128 | 128 | $configurations = []; |
129 | - if (file_exists($file) && ! in_array($file, get_included_files(), true)) { |
|
129 | + if (file_exists($file) && !in_array($file, get_included_files(), true)) { |
|
130 | 130 | $configurations = (array) require $file; |
131 | 131 | } |
132 | 132 | |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | { |
152 | 152 | if (is_array($accepts_values)) { |
153 | 153 | $accepts_values = '(Accept values: ' . implode('/', $accepts_values) . ')'; |
154 | - } elseif (! is_string($accepts_values)) { |
|
154 | + } elseif (!is_string($accepts_values)) { |
|
155 | 155 | throw new InvalidArgumentException('Misuse of the method ' . __METHOD__); |
156 | 156 | } |
157 | 157 | |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | $schema = require $app_schema; |
194 | 194 | } |
195 | 195 | |
196 | - if (empty($schema) || ! ($schema instanceof Schema)) { |
|
196 | + if (empty($schema) || !($schema instanceof Schema)) { |
|
197 | 197 | $schema = Expect::mixed(); |
198 | 198 | } |
199 | 199 | |
@@ -280,12 +280,12 @@ discard block |
||
280 | 280 | { |
281 | 281 | $config = $this->get('app.show_debugbar', 'auto'); |
282 | 282 | |
283 | - if (! in_array($config, ['auto', true, false], true)) { |
|
283 | + if (!in_array($config, ['auto', true, false], true)) { |
|
284 | 284 | self::exceptBadConfigValue('show_debugbar', ['auto', true, false], 'app'); |
285 | 285 | } |
286 | 286 | |
287 | 287 | if ($config === 'auto') { |
288 | - $this->set('app.show_debugbar', ! is_online()); |
|
288 | + $this->set('app.show_debugbar', !is_online()); |
|
289 | 289 | } |
290 | 290 | } |
291 | 291 | } |
@@ -94,8 +94,8 @@ |
||
94 | 94 | public function getVarData(): array |
95 | 95 | { |
96 | 96 | return [ |
97 | - 'Données de la vues' => array_filter($this->viewer->getData(), function ($data) { |
|
98 | - return ! ($data instanceof ErrorBag); |
|
97 | + 'Données de la vues' => array_filter($this->viewer->getData(), function($data) { |
|
98 | + return !($data instanceof ErrorBag); |
|
99 | 99 | }), |
100 | 100 | ]; |
101 | 101 | } |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | $this->config = $config ?? (object) config('toolbar'); |
67 | 67 | |
68 | 68 | foreach ($this->config->collectors as $collector) { |
69 | - if (! class_exists($collector)) { |
|
69 | + if (!class_exists($collector)) { |
|
70 | 70 | logger()->critical( |
71 | 71 | 'Toolbar collector does not exist (' . $collector . ').' |
72 | 72 | . ' Please check $collectors in the app/Config/toolbar.php file.' |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | $data['vars']['varData'][esc($heading)] = $varData; |
133 | 133 | } |
134 | 134 | |
135 | - if (! empty($_SESSION)) { |
|
135 | + if (!empty($_SESSION)) { |
|
136 | 136 | foreach ($_SESSION as $key => $value) { |
137 | 137 | // Remplacez les données binaires par une chaîne pour éviter l'échec de json_encode. |
138 | 138 | if (is_string($value) && preg_match('~[^\x20-\x7E\t\r\n]~', $value)) { |
@@ -205,8 +205,8 @@ discard block |
||
205 | 205 | $output = ''; |
206 | 206 | |
207 | 207 | foreach ($rows as $row) { |
208 | - $hasChildren = isset($row['children']) && ! empty($row['children']); |
|
209 | - $isQuery = isset($row['query']) && ! empty($row['query']); |
|
208 | + $hasChildren = isset($row['children']) && !empty($row['children']); |
|
209 | + $isQuery = isset($row['query']) && !empty($row['query']); |
|
210 | 210 | |
211 | 211 | // Ouvrir la chronologie du contrôleur par défaut |
212 | 212 | $open = $row['name'] === 'Controller'; |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | |
272 | 272 | // Le collecter |
273 | 273 | foreach ($collectors as $collector) { |
274 | - if (! $collector['hasTimelineData']) { |
|
274 | + if (!$collector['hasTimelineData']) { |
|
275 | 275 | continue; |
276 | 276 | } |
277 | 277 | |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | array_multisort(...$sortArray); |
289 | 289 | |
290 | 290 | // Ajouter une heure de fin à chaque élément |
291 | - array_walk($data, static function (&$row) { |
|
291 | + array_walk($data, static function(&$row) { |
|
292 | 292 | $row['end'] = $row['start'] + $row['duration']; |
293 | 293 | }); |
294 | 294 | |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | $element = array_shift($elements); |
308 | 308 | |
309 | 309 | // Si nous avons des enfants derrière nous, récupérez-les et attachez-les-nous |
310 | - while (! empty($elements) && $elements[array_key_first($elements)]['end'] <= $element['end']) { |
|
310 | + while (!empty($elements) && $elements[array_key_first($elements)]['end'] <= $element['end']) { |
|
311 | 311 | $element['children'][] = array_shift($elements); |
312 | 312 | } |
313 | 313 | |
@@ -331,14 +331,14 @@ discard block |
||
331 | 331 | */ |
332 | 332 | protected function collectVarData(): array |
333 | 333 | { |
334 | - if (! ($this->config->collectVarData ?? true)) { |
|
334 | + if (!($this->config->collectVarData ?? true)) { |
|
335 | 335 | return []; |
336 | 336 | } |
337 | 337 | |
338 | 338 | $data = []; |
339 | 339 | |
340 | 340 | foreach ($this->collectors as $collector) { |
341 | - if (! $collector->hasVarData()) { |
|
341 | + if (!$collector->hasVarData()) { |
|
342 | 342 | continue; |
343 | 343 | } |
344 | 344 | |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | } |
373 | 373 | |
374 | 374 | // Si on a desactiver le debogage ou l'affichage de la debugbar, on s'arrete |
375 | - if (! BLITZ_DEBUG || ! $this->config->show_debugbar) { |
|
375 | + if (!BLITZ_DEBUG || !$this->config->show_debugbar) { |
|
376 | 376 | return $response; |
377 | 377 | } |
378 | 378 | |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | // Mise à jour vers microtime() pour que nous puissions obtenir l'historique |
388 | 388 | $time = sprintf('%.6f', Date::now()->format('U.u')); |
389 | 389 | |
390 | - if (! is_dir($this->debugPath)) { |
|
390 | + if (!is_dir($this->debugPath)) { |
|
391 | 391 | mkdir($this->debugPath, 0o777); |
392 | 392 | } |
393 | 393 | |
@@ -397,7 +397,7 @@ discard block |
||
397 | 397 | |
398 | 398 | // Les formats non HTML ne doivent pas inclure la barre de débogage, |
399 | 399 | // puis nous envoyons des en-têtes indiquant où trouver les données de débogage pour cette réponse |
400 | - if ($request->isAJAX() || ! str_contains($format, 'html')) { |
|
400 | + if ($request->isAJAX() || !str_contains($format, 'html')) { |
|
401 | 401 | return $response |
402 | 402 | ->withHeader('Debugbar-Time', "{$time}") |
403 | 403 | ->withHeader('Debugbar-Link', site_url("?debugbar_time={$time}")); |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | $controller = $routes->getDefaultController(); |
179 | 179 | } |
180 | 180 | |
181 | - if (! $fullName && is_string($controller)) { |
|
181 | + if (!$fullName && is_string($controller)) { |
|
182 | 182 | $controller = str_replace($routes->getDefaultNamespace(), '', $controller); |
183 | 183 | } |
184 | 184 | |
@@ -323,14 +323,14 @@ discard block |
||
323 | 323 | return; |
324 | 324 | } |
325 | 325 | |
326 | - if (is_cli() && ! on_test()) { |
|
326 | + if (is_cli() && !on_test()) { |
|
327 | 327 | // @codeCoverageIgnoreStart |
328 | 328 | // $this->request = Services::clirequest($this->config); |
329 | 329 | // @codeCoverageIgnoreEnd |
330 | 330 | } |
331 | 331 | |
332 | 332 | $version = $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.1'; |
333 | - if (! is_numeric($version)) { |
|
333 | + if (!is_numeric($version)) { |
|
334 | 334 | $version = substr($version, strpos($version, '/') + 1); |
335 | 335 | } |
336 | 336 | |
@@ -349,7 +349,7 @@ discard block |
||
349 | 349 | // Supposons le succès jusqu'à preuve du contraire. |
350 | 350 | $this->response = Services::response()->withStatus(200); |
351 | 351 | |
352 | - if (! is_cli() || on_test()) { |
|
352 | + if (!is_cli() || on_test()) { |
|
353 | 353 | } |
354 | 354 | |
355 | 355 | $this->response = $this->response->withProtocolVersion($this->request->getProtocolVersion()); |
@@ -463,7 +463,7 @@ discard block |
||
463 | 463 | */ |
464 | 464 | protected function determinePath(): string |
465 | 465 | { |
466 | - if (! empty($this->path)) { |
|
466 | + if (!empty($this->path)) { |
|
467 | 467 | return $this->path; |
468 | 468 | } |
469 | 469 | |
@@ -504,7 +504,7 @@ discard block |
||
504 | 504 | } |
505 | 505 | |
506 | 506 | // Essayez de charger automatiquement la classe |
507 | - if (! class_exists($this->controller, true) || ($this->method[0] === '_' && $this->method !== '__invoke')) { |
|
507 | + if (!class_exists($this->controller, true) || ($this->method[0] === '_' && $this->method !== '__invoke')) { |
|
508 | 508 | throw PageNotFoundException::controllerNotFound($this->controller, $this->method); |
509 | 509 | } |
510 | 510 | |
@@ -597,7 +597,7 @@ discard block |
||
597 | 597 | echo $this->outputBufferingEnd(); |
598 | 598 | flush(); |
599 | 599 | |
600 | - throw PageNotFoundException::pageNotFound(! on_prod() || is_cli() ? $e->getMessage() : ''); |
|
600 | + throw PageNotFoundException::pageNotFound(!on_prod() || is_cli() ? $e->getMessage() : ''); |
|
601 | 601 | } |
602 | 602 | |
603 | 603 | /** |
@@ -639,7 +639,7 @@ discard block |
||
639 | 639 | public function storePreviousURL($uri) |
640 | 640 | { |
641 | 641 | // Ignorer les requêtes CLI |
642 | - if (is_cli() && ! on_test()) { |
|
642 | + if (is_cli() && !on_test()) { |
|
643 | 643 | return; // @codeCoverageIgnore |
644 | 644 | } |
645 | 645 | |
@@ -649,7 +649,7 @@ discard block |
||
649 | 649 | } |
650 | 650 | |
651 | 651 | // Ignorer les reponses non-HTML |
652 | - if (! str_contains($this->response->getHeaderLine('Content-Type'), 'text/html')) { |
|
652 | + if (!str_contains($this->response->getHeaderLine('Content-Type'), 'text/html')) { |
|
653 | 653 | return; |
654 | 654 | } |
655 | 655 | |
@@ -761,11 +761,11 @@ discard block |
||
761 | 761 | */ |
762 | 762 | private function spoofRequestMethod(): callable |
763 | 763 | { |
764 | - return static function (ServerRequestInterface $request, ResponseInterface $response, callable $next) { |
|
764 | + return static function(ServerRequestInterface $request, ResponseInterface $response, callable $next) { |
|
765 | 765 | $post = $request->getParsedBody(); |
766 | 766 | |
767 | 767 | // Ne fonctionne qu'avec les formulaires POST |
768 | - if (strtoupper($request->getMethod()) === 'POST' && ! empty($post['_method'])) { |
|
768 | + if (strtoupper($request->getMethod()) === 'POST' && !empty($post['_method'])) { |
|
769 | 769 | // Accepte seulement PUT, PATCH, DELETE |
770 | 770 | if (in_array(strtoupper($post['_method']), ['PUT', 'PATCH', 'DELETE'], true)) { |
771 | 771 | $request = $request->withMethod($post['_method']); |
@@ -778,15 +778,15 @@ discard block |
||
778 | 778 | |
779 | 779 | private function bootApp(): callable |
780 | 780 | { |
781 | - return function (ServerRequestInterface $request, ResponseInterface $response, callable $next): ResponseInterface { |
|
781 | + return function(ServerRequestInterface $request, ResponseInterface $response, callable $next): ResponseInterface { |
|
782 | 782 | try { |
783 | 783 | $returned = $this->startController($request, $response); |
784 | 784 | |
785 | 785 | // Closure controller has run in startController(). |
786 | - if (! is_callable($this->controller)) { |
|
786 | + if (!is_callable($this->controller)) { |
|
787 | 787 | $controller = $this->createController($request, $response); |
788 | 788 | |
789 | - if (! method_exists($controller, '_remap') && ! is_callable([$controller, $this->method], false)) { |
|
789 | + if (!method_exists($controller, '_remap') && !is_callable([$controller, $this->method], false)) { |
|
790 | 790 | throw PageNotFoundException::methodNotFound($this->method); |
791 | 791 | } |
792 | 792 |
@@ -35,7 +35,7 @@ |
||
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 |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | // Incluez le fichier routesFile s'il n'existe pas. |
264 | 264 | // Ne conserver que pour les fins BC pour l'instant. |
265 | 265 | $routeFiles = $this->routeFiles; |
266 | - if (! in_array($routesFile, $routeFiles, true)) { |
|
266 | + if (!in_array($routesFile, $routeFiles, true)) { |
|
267 | 267 | $routeFiles[] = $routesFile; |
268 | 268 | } |
269 | 269 | |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | $routes = $this; |
272 | 272 | |
273 | 273 | foreach ($routeFiles as $routesFile) { |
274 | - if (! is_file($routesFile)) { |
|
274 | + if (!is_file($routesFile)) { |
|
275 | 275 | logger()->warning(sprintf('Fichier de route introuvable : "%s"', $routesFile)); |
276 | 276 | |
277 | 277 | continue; |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | */ |
321 | 321 | public function placeholder(array|string $placeholder, ?string $pattern = null): self |
322 | 322 | { |
323 | - if (! is_array($placeholder)) { |
|
323 | + if (!is_array($placeholder)) { |
|
324 | 324 | $placeholder = [$placeholder => $pattern]; |
325 | 325 | } |
326 | 326 | |
@@ -1013,7 +1013,7 @@ discard block |
||
1013 | 1013 | * |
1014 | 1014 | * @param array|Closure|string $to |
1015 | 1015 | */ |
1016 | - public function match(array $verbs = [], string $from = '', $to = '', ?array $options = null): self |
|
1016 | + public function match(array $verbs = [], string $from = '', $to = '', ?array $options = null) : self |
|
1017 | 1017 | { |
1018 | 1018 | if (empty($from) || empty($to)) { |
1019 | 1019 | throw new InvalidArgumentException('Vous devez fournir les paramètres : $from, $to.'); |
@@ -1199,7 +1199,7 @@ discard block |
||
1199 | 1199 | $from = $route['from']; |
1200 | 1200 | |
1201 | 1201 | // on ignore les closures |
1202 | - if (! is_string($to)) { |
|
1202 | + if (!is_string($to)) { |
|
1203 | 1203 | continue; |
1204 | 1204 | } |
1205 | 1205 | |
@@ -1210,7 +1210,7 @@ discard block |
||
1210 | 1210 | |
1211 | 1211 | // S'il y a une chance de correspondance, alors ce sera |
1212 | 1212 | // soit avec $search au début de la chaîne $to. |
1213 | - if (! str_starts_with($to, $search)) { |
|
1213 | + if (!str_starts_with($to, $search)) { |
|
1214 | 1214 | continue; |
1215 | 1215 | } |
1216 | 1216 | |
@@ -1288,7 +1288,7 @@ discard block |
||
1288 | 1288 | |
1289 | 1289 | // Construisez notre chaîne résultante, en insérant les $params aux endroits appropriés. |
1290 | 1290 | foreach ($matches[0] as $index => $placeholder) { |
1291 | - if (! isset($params[$index])) { |
|
1291 | + if (!isset($params[$index])) { |
|
1292 | 1292 | throw new InvalidArgumentException( |
1293 | 1293 | 'Argument manquant pour "' . $placeholder . '" dans la route "' . $from . '".' |
1294 | 1294 | ); |
@@ -1299,7 +1299,7 @@ discard block |
||
1299 | 1299 | // ou peut-être que $placeholder n'est pas un espace réservé, mais une regex. |
1300 | 1300 | $pattern = $this->placeholders[$placeholderName] ?? $placeholder; |
1301 | 1301 | |
1302 | - if (! preg_match('#^' . $pattern . '$#u', $params[$index])) { |
|
1302 | + if (!preg_match('#^' . $pattern . '$#u', $params[$index])) { |
|
1303 | 1303 | throw RouterException::invalidParameterType(); |
1304 | 1304 | } |
1305 | 1305 | |
@@ -1356,7 +1356,7 @@ discard block |
||
1356 | 1356 | $from = trim($from, '/'); |
1357 | 1357 | } |
1358 | 1358 | |
1359 | - if (is_string($to) && ! str_contains($to, '::') && class_exists($to) && method_exists($to, '__invoke')) { |
|
1359 | + if (is_string($to) && !str_contains($to, '::') && class_exists($to) && method_exists($to, '__invoke')) { |
|
1360 | 1360 | $to = [$to, '__invoke']; |
1361 | 1361 | } |
1362 | 1362 | |
@@ -1382,9 +1382,9 @@ discard block |
||
1382 | 1382 | } |
1383 | 1383 | |
1384 | 1384 | // Limitation du nom d'hôte ? |
1385 | - if (! empty($options['hostname'])) { |
|
1385 | + if (!empty($options['hostname'])) { |
|
1386 | 1386 | // @todo déterminer s'il existe un moyen de mettre les hôtes sur liste blanche ? |
1387 | - if (! $this->checkHostname($options['hostname'])) { |
|
1387 | + if (!$this->checkHostname($options['hostname'])) { |
|
1388 | 1388 | return; |
1389 | 1389 | } |
1390 | 1390 | |
@@ -1392,10 +1392,10 @@ discard block |
||
1392 | 1392 | } |
1393 | 1393 | |
1394 | 1394 | // Limitation du nom sous-domaine ? |
1395 | - elseif (! empty($options['subdomain'])) { |
|
1395 | + elseif (!empty($options['subdomain'])) { |
|
1396 | 1396 | // Si nous ne correspondons pas au sous-domaine actuel, alors |
1397 | 1397 | // nous n'avons pas besoin d'ajouter la route. |
1398 | - if (! $this->checkSubdomains($options['subdomain'])) { |
|
1398 | + if (!$this->checkSubdomains($options['subdomain'])) { |
|
1399 | 1399 | return; |
1400 | 1400 | } |
1401 | 1401 | |
@@ -1428,9 +1428,9 @@ discard block |
||
1428 | 1428 | } |
1429 | 1429 | |
1430 | 1430 | // S'il s'agit d'une redirection, aucun traitement |
1431 | - if (! isset($options['redirect']) && is_string($to)) { |
|
1431 | + if (!isset($options['redirect']) && is_string($to)) { |
|
1432 | 1432 | // Si aucun espace de noms n'est trouvé, ajouter l'espace de noms par défaut |
1433 | - if (! str_contains($to, '\\') || strpos($to, '\\') > 0) { |
|
1433 | + if (!str_contains($to, '\\') || strpos($to, '\\') > 0) { |
|
1434 | 1434 | $namespace = $options['namespace'] ?? $this->defaultNamespace; |
1435 | 1435 | $to = trim($namespace, '\\') . '\\' . $to; |
1436 | 1436 | } |
@@ -1447,7 +1447,7 @@ discard block |
||
1447 | 1447 | // cela ne fonctionne que parce que les routes découvertes sont ajoutées juste avant |
1448 | 1448 | // pour tenter de router la requête. |
1449 | 1449 | $routeKeyExists = isset($this->routes[$verb][$routeKey]); |
1450 | - if ((isset($this->routesNames[$verb][$name]) || $routeKeyExists) && ! $overwrite) { |
|
1450 | + if ((isset($this->routesNames[$verb][$name]) || $routeKeyExists) && !$overwrite) { |
|
1451 | 1451 | return; |
1452 | 1452 | } |
1453 | 1453 | |
@@ -1473,7 +1473,7 @@ discard block |
||
1473 | 1473 | private function checkHostname(string $hostname): bool |
1474 | 1474 | { |
1475 | 1475 | // Les appels CLI ne peuvent pas être sur le nom d'hôte. |
1476 | - if (! isset($this->httpHost) || is_cli()) { |
|
1476 | + if (!isset($this->httpHost) || is_cli()) { |
|
1477 | 1477 | return false; |
1478 | 1478 | } |
1479 | 1479 | |
@@ -1489,7 +1489,7 @@ discard block |
||
1489 | 1489 | private function checkSubdomains($subdomains): bool |
1490 | 1490 | { |
1491 | 1491 | // Les appels CLI ne peuvent pas être sur le sous-domaine. |
1492 | - if (! isset($this->httpHost)) { |
|
1492 | + if (!isset($this->httpHost)) { |
|
1493 | 1493 | return false; |
1494 | 1494 | } |
1495 | 1495 | |
@@ -1497,13 +1497,13 @@ discard block |
||
1497 | 1497 | $this->currentSubdomain = $this->determineCurrentSubdomain(); |
1498 | 1498 | } |
1499 | 1499 | |
1500 | - if (! is_array($subdomains)) { |
|
1500 | + if (!is_array($subdomains)) { |
|
1501 | 1501 | $subdomains = [$subdomains]; |
1502 | 1502 | } |
1503 | 1503 | |
1504 | 1504 | // Les routes peuvent être limitées à n'importe quel sous-domaine. Dans ce cas, cependant, |
1505 | 1505 | // il nécessite la présence d'un sous-domaine. |
1506 | - if (! empty($this->currentSubdomain) && in_array('*', $subdomains, true)) { |
|
1506 | + if (!empty($this->currentSubdomain) && in_array('*', $subdomains, true)) { |
|
1507 | 1507 | return true; |
1508 | 1508 | } |
1509 | 1509 | |
@@ -1525,7 +1525,7 @@ discard block |
||
1525 | 1525 | // sur l'URL sinon parse_url sera mal interprété |
1526 | 1526 | // 'hôte' comme 'chemin'. |
1527 | 1527 | $url = $this->httpHost; |
1528 | - if (! str_starts_with($url, 'http')) { |
|
1528 | + if (!str_starts_with($url, 'http')) { |
|
1529 | 1529 | $url = 'http://' . $url; |
1530 | 1530 | } |
1531 | 1531 | |
@@ -1566,7 +1566,7 @@ discard block |
||
1566 | 1566 | |
1567 | 1567 | private function getControllerName(Closure|string $handler): ?string |
1568 | 1568 | { |
1569 | - if (! is_string($handler)) { |
|
1569 | + if (!is_string($handler)) { |
|
1570 | 1570 | return null; |
1571 | 1571 | } |
1572 | 1572 | |
@@ -1625,13 +1625,13 @@ discard block |
||
1625 | 1625 | */ |
1626 | 1626 | private function replaceLocale(string $route, ?string $locale = null): string |
1627 | 1627 | { |
1628 | - if (! str_contains($route, '{locale}')) { |
|
1628 | + if (!str_contains($route, '{locale}')) { |
|
1629 | 1629 | return $route; |
1630 | 1630 | } |
1631 | 1631 | |
1632 | 1632 | // Vérifier les paramètres régionaux non valides |
1633 | 1633 | if ($locale !== null) { |
1634 | - if (! in_array($locale, config('app.supported_locales'), true)) { |
|
1634 | + if (!in_array($locale, config('app.supported_locales'), true)) { |
|
1635 | 1635 | $locale = null; |
1636 | 1636 | } |
1637 | 1637 | } |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | { |
71 | 71 | helper('assets'); |
72 | 72 | |
73 | - if (! empty($viewPathLocator)) { |
|
73 | + if (!empty($viewPathLocator)) { |
|
74 | 74 | if (is_string($viewPathLocator)) { |
75 | 75 | $this->viewPath = rtrim($viewPathLocator, '\\/ ') . DS; |
76 | 76 | } elseif ($viewPathLocator instanceof Locator) { |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | $options = (array) $options; |
236 | 236 | |
237 | 237 | $viewPath = $options['viewPath'] ?? $this->viewPath; |
238 | - if (! empty($viewPath)) { |
|
238 | + if (!empty($viewPath)) { |
|
239 | 239 | $file = str_replace('/', DS, rtrim($viewPath, '/\\') . DS . ltrim($view, '/\\')); |
240 | 240 | } else { |
241 | 241 | $file = $view; |
@@ -243,14 +243,14 @@ discard block |
||
243 | 243 | |
244 | 244 | $file = Helpers::ensureExt($file, $ext); |
245 | 245 | |
246 | - if (! is_file($file) && $this->locator instanceof Locator) { |
|
246 | + if (!is_file($file) && $this->locator instanceof Locator) { |
|
247 | 247 | $file = $this->locator->locateFile($view, 'Views', empty($ext) ? 'php' : $ext); |
248 | 248 | } |
249 | 249 | |
250 | 250 | $file = realpath($file); |
251 | 251 | |
252 | 252 | // locateFile renverra une chaîne vide si le fichier est introuvable. |
253 | - if (! is_file($file)) { |
|
253 | + if (!is_file($file)) { |
|
254 | 254 | throw ViewException::invalidFile($view); |
255 | 255 | } |
256 | 256 |