@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | // Incluez le fichier routesFile s'il n'existe pas. |
259 | 259 | // Ne conserver que pour les fins BC pour l'instant. |
260 | 260 | $routeFiles = $this->routeFiles; |
261 | - if (! in_array($routesFile, $routeFiles, true)) { |
|
261 | + if (!in_array($routesFile, $routeFiles, true)) { |
|
262 | 262 | $routeFiles[] = $routesFile; |
263 | 263 | } |
264 | 264 | |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | $routes = $this; |
267 | 267 | |
268 | 268 | foreach ($routeFiles as $routesFile) { |
269 | - if (! is_file($routesFile)) { |
|
269 | + if (!is_file($routesFile)) { |
|
270 | 270 | logger()->warning(sprintf('Fichier de route introuvable : "%s"', $routesFile)); |
271 | 271 | |
272 | 272 | continue; |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | */ |
316 | 316 | public function placeholder(array|string $placeholder, ?string $pattern = null): self |
317 | 317 | { |
318 | - if (! is_array($placeholder)) { |
|
318 | + if (!is_array($placeholder)) { |
|
319 | 319 | $placeholder = [$placeholder => $pattern]; |
320 | 320 | } |
321 | 321 | |
@@ -418,7 +418,7 @@ discard block |
||
418 | 418 | // Nous avons besoin de cette variable dans la portée locale pour que les fichiers de route puissent y accéder. |
419 | 419 | $routes = $this; |
420 | 420 | |
421 | - $files = $this->locator->search('Config/routes.php'); |
|
421 | + $files = $this->locator->search('Config/routes.php'); |
|
422 | 422 | |
423 | 423 | foreach ($files as $file) { |
424 | 424 | // N'incluez plus notre fichier principal... |
@@ -562,7 +562,7 @@ discard block |
||
562 | 562 | // que nous pourrions avoir besoin de faire. |
563 | 563 | $this->discoverRoutes(); |
564 | 564 | |
565 | - $routes = []; |
|
565 | + $routes = []; |
|
566 | 566 | if (isset($this->routes[$verb])) { |
567 | 567 | // Conserve les itinéraires du verbe actuel au début afin qu'ils soient |
568 | 568 | // mis en correspondance avant l'un des itinéraires génériques "add". |
@@ -654,7 +654,7 @@ discard block |
||
654 | 654 | { |
655 | 655 | // Utilisez le modèle de la route nommée s'il s'agit d'une route nommée. |
656 | 656 | if (array_key_exists($to, $this->routesNames['*'])) { |
657 | - $routeName = $to; |
|
657 | + $routeName = $to; |
|
658 | 658 | $routeKey = $this->routesNames['*'][$routeName]; |
659 | 659 | $redirectTo = [$routeKey => $this->routes['*'][$routeKey]['handler']]; |
660 | 660 | |
@@ -1006,7 +1006,7 @@ discard block |
||
1006 | 1006 | * |
1007 | 1007 | * @param array|Closure|string $to |
1008 | 1008 | */ |
1009 | - public function match(array $verbs = [], string $from = '', $to = '', ?array $options = null): self |
|
1009 | + public function match(array $verbs = [], string $from = '', $to = '', ?array $options = null) : self |
|
1010 | 1010 | { |
1011 | 1011 | if (empty($from) || empty($to)) { |
1012 | 1012 | throw new InvalidArgumentException('Vous devez fournir les paramètres : $from, $to.'); |
@@ -1193,7 +1193,7 @@ discard block |
||
1193 | 1193 | $from = $route['from']; |
1194 | 1194 | |
1195 | 1195 | // on ignore les closures |
1196 | - if (! is_string($to)) { |
|
1196 | + if (!is_string($to)) { |
|
1197 | 1197 | continue; |
1198 | 1198 | } |
1199 | 1199 | |
@@ -1282,7 +1282,7 @@ discard block |
||
1282 | 1282 | |
1283 | 1283 | // Construisez notre chaîne résultante, en insérant les $params aux endroits appropriés. |
1284 | 1284 | foreach ($matches[0] as $index => $placeholder) { |
1285 | - if (! isset($params[$index])) { |
|
1285 | + if (!isset($params[$index])) { |
|
1286 | 1286 | throw new InvalidArgumentException( |
1287 | 1287 | 'Argument manquant pour "' . $placeholder . '" dans la route "' . $from . '".' |
1288 | 1288 | ); |
@@ -1293,7 +1293,7 @@ discard block |
||
1293 | 1293 | // ou peut-être que $placeholder n'est pas un espace réservé, mais une regex. |
1294 | 1294 | $pattern = $this->placeholders[$placeholderName] ?? $placeholder; |
1295 | 1295 | |
1296 | - if (! preg_match('#^' . $pattern . '$#u', $params[$index])) { |
|
1296 | + if (!preg_match('#^' . $pattern . '$#u', $params[$index])) { |
|
1297 | 1297 | throw RouterException::invalidParameterType(); |
1298 | 1298 | } |
1299 | 1299 | |
@@ -1376,9 +1376,9 @@ discard block |
||
1376 | 1376 | } |
1377 | 1377 | |
1378 | 1378 | // Limitation du nom d'hôte ? |
1379 | - if (! empty($options['hostname'])) { |
|
1379 | + if (!empty($options['hostname'])) { |
|
1380 | 1380 | // @todo déterminer s'il existe un moyen de mettre les hôtes sur liste blanche ? |
1381 | - if (! $this->checkHostname($options['hostname'])) { |
|
1381 | + if (!$this->checkHostname($options['hostname'])) { |
|
1382 | 1382 | return; |
1383 | 1383 | } |
1384 | 1384 | |
@@ -1386,10 +1386,10 @@ discard block |
||
1386 | 1386 | } |
1387 | 1387 | |
1388 | 1388 | // Limitation du nom sous-domaine ? |
1389 | - elseif (! empty($options['subdomain'])) { |
|
1389 | + elseif (!empty($options['subdomain'])) { |
|
1390 | 1390 | // Si nous ne correspondons pas au sous-domaine actuel, alors |
1391 | 1391 | // nous n'avons pas besoin d'ajouter la route. |
1392 | - if (! $this->checkSubdomains($options['subdomain'])) { |
|
1392 | + if (!$this->checkSubdomains($options['subdomain'])) { |
|
1393 | 1393 | return; |
1394 | 1394 | } |
1395 | 1395 | |
@@ -1422,7 +1422,7 @@ discard block |
||
1422 | 1422 | } |
1423 | 1423 | |
1424 | 1424 | // S'il s'agit d'une redirection, aucun traitement |
1425 | - if (! isset($options['redirect']) && is_string($to)) { |
|
1425 | + if (!isset($options['redirect']) && is_string($to)) { |
|
1426 | 1426 | // Si aucun espace de noms n'est trouvé, ajouter l'espace de noms par défaut |
1427 | 1427 | if (strpos($to, '\\') === false || strpos($to, '\\') > 0) { |
1428 | 1428 | $namespace = $options['namespace'] ?? $this->defaultNamespace; |
@@ -1441,7 +1441,7 @@ discard block |
||
1441 | 1441 | // cela ne fonctionne que parce que les routes découvertes sont ajoutées juste avant |
1442 | 1442 | // pour tenter de router la requête. |
1443 | 1443 | $routeKeyExists = isset($this->routes[$verb][$routeKey]); |
1444 | - if ((isset($this->routesNames[$verb][$name]) || $routeKeyExists) && ! $overwrite) { |
|
1444 | + if ((isset($this->routesNames[$verb][$name]) || $routeKeyExists) && !$overwrite) { |
|
1445 | 1445 | return; |
1446 | 1446 | } |
1447 | 1447 | |
@@ -1467,7 +1467,7 @@ discard block |
||
1467 | 1467 | private function checkHostname(string $hostname): bool |
1468 | 1468 | { |
1469 | 1469 | // Les appels CLI ne peuvent pas être sur le nom d'hôte. |
1470 | - if (! isset($this->httpHost) || is_cli()) { |
|
1470 | + if (!isset($this->httpHost) || is_cli()) { |
|
1471 | 1471 | return false; |
1472 | 1472 | } |
1473 | 1473 | |
@@ -1483,7 +1483,7 @@ discard block |
||
1483 | 1483 | private function checkSubdomains($subdomains): bool |
1484 | 1484 | { |
1485 | 1485 | // Les appels CLI ne peuvent pas être sur le sous-domaine. |
1486 | - if (! isset($this->httpHost)) { |
|
1486 | + if (!isset($this->httpHost)) { |
|
1487 | 1487 | return false; |
1488 | 1488 | } |
1489 | 1489 | |
@@ -1491,13 +1491,13 @@ discard block |
||
1491 | 1491 | $this->currentSubdomain = $this->determineCurrentSubdomain(); |
1492 | 1492 | } |
1493 | 1493 | |
1494 | - if (! is_array($subdomains)) { |
|
1494 | + if (!is_array($subdomains)) { |
|
1495 | 1495 | $subdomains = [$subdomains]; |
1496 | 1496 | } |
1497 | 1497 | |
1498 | 1498 | // Les routes peuvent être limitées à n'importe quel sous-domaine. Dans ce cas, cependant, |
1499 | 1499 | // il nécessite la présence d'un sous-domaine. |
1500 | - if (! empty($this->currentSubdomain) && in_array('*', $subdomains, true)) { |
|
1500 | + if (!empty($this->currentSubdomain) && in_array('*', $subdomains, true)) { |
|
1501 | 1501 | return true; |
1502 | 1502 | } |
1503 | 1503 | |
@@ -1560,7 +1560,7 @@ discard block |
||
1560 | 1560 | |
1561 | 1561 | private function getControllerName(Closure|string $handler): ?string |
1562 | 1562 | { |
1563 | - if (! is_string($handler)) { |
|
1563 | + if (!is_string($handler)) { |
|
1564 | 1564 | return null; |
1565 | 1565 | } |
1566 | 1566 | |
@@ -1625,7 +1625,7 @@ discard block |
||
1625 | 1625 | |
1626 | 1626 | // Vérifier les paramètres régionaux non valides |
1627 | 1627 | if ($locale !== null) { |
1628 | - if (! in_array($locale, config('app.supported_locales'), true)) { |
|
1628 | + if (!in_array($locale, config('app.supported_locales'), true)) { |
|
1629 | 1629 | $locale = null; |
1630 | 1630 | } |
1631 | 1631 | } |