@@ -45,8 +45,7 @@ |
||
45 | 45 | { |
46 | 46 | try { |
47 | 47 | return $this->to($this->generator->route('home'), $status); |
48 | - } |
|
49 | - catch (HttpException) { |
|
48 | + } catch (HttpException) { |
|
50 | 49 | return $this->to('/', $status); |
51 | 50 | } |
52 | 51 | } |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | { |
123 | 123 | $request = $this->generator->getRequest(); |
124 | 124 | |
125 | - $intended = $request->method() === 'GET' && ! $request->expectsJson() |
|
125 | + $intended = $request->method() === 'GET' && !$request->expectsJson() |
|
126 | 126 | ? $this->generator->full() |
127 | 127 | : $this->generator->previous(); |
128 | 128 | |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | $errors = [$key => $errors]; |
177 | 177 | } |
178 | 178 | |
179 | - if (! empty($errors)) { |
|
179 | + if (!empty($errors)) { |
|
180 | 180 | Services::viewer()->share('errors', new ErrorBag($this->session->flashErrors($errors, $key))); |
181 | 181 | } |
182 | 182 |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | |
123 | 123 | /** |
124 | 124 | * Tableau des noms des routes |
125 | - * |
|
125 | + * |
|
126 | 126 | * [ |
127 | 127 | * verb => [ |
128 | 128 | * routeName => routeKey(regex) |
@@ -221,14 +221,14 @@ discard block |
||
221 | 221 | |
222 | 222 | /** |
223 | 223 | * Constructor |
224 | - * |
|
225 | - * @var Locator $locator Descripteur du localisateur de fichiers à utiliser. |
|
224 | + * |
|
225 | + * @var Locator $locator Descripteur du localisateur de fichiers à utiliser. |
|
226 | 226 | */ |
227 | 227 | public function __construct(protected Locator $locator, object $routing) |
228 | 228 | { |
229 | 229 | $this->httpHost = Services::request()->getEnv('HTTP_HOST'); |
230 | 230 | |
231 | - // Configuration basée sur le fichier de config. Laissez le fichier routes substituer. |
|
231 | + // Configuration basée sur le fichier de config. Laissez le fichier routes substituer. |
|
232 | 232 | $this->defaultNamespace = rtrim($routing->default_namespace ?: $this->defaultNamespace, '\\') . '\\'; |
233 | 233 | $this->defaultController = $routing->default_controller ?: $this->defaultController; |
234 | 234 | $this->defaultMethod = $routing->default_method ?: $this->defaultMethod; |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | $this->routeFiles = $routing->route_files ?: $this->routeFiles; |
239 | 239 | $this->prioritize = $routing->prioritize ?: $this->prioritize; |
240 | 240 | |
241 | - // Normaliser la chaîne de path dans le tableau routeFiles. |
|
241 | + // Normaliser la chaîne de path dans le tableau routeFiles. |
|
242 | 242 | foreach ($this->routeFiles as $routeKey => $routesFile) { |
243 | 243 | $this->routeFiles[$routeKey] = realpath($routesFile) ?: $routesFile; |
244 | 244 | } |
@@ -256,18 +256,18 @@ discard block |
||
256 | 256 | } |
257 | 257 | |
258 | 258 | // Incluez le fichier routesFile s'il n'existe pas. |
259 | - // Ne conserver que pour les fins BC pour l'instant. |
|
259 | + // Ne conserver que pour les fins BC pour l'instant. |
|
260 | 260 | $routeFiles = $this->routeFiles; |
261 | 261 | if (! in_array($routesFile, $routeFiles, true)) { |
262 | 262 | $routeFiles[] = $routesFile; |
263 | 263 | } |
264 | 264 | |
265 | - // Nous avons besoin de cette variable dans la portée locale pour que les fichiers de route puissent y accéder. |
|
265 | + // Nous avons besoin de cette variable dans la portée locale pour que les fichiers de route puissent y accéder. |
|
266 | 266 | $routes = $this; |
267 | 267 | |
268 | - foreach ($routeFiles as $routesFile) { |
|
268 | + foreach ($routeFiles as $routesFile) { |
|
269 | 269 | if (! is_file($routesFile)) { |
270 | - logger()->warning(sprintf('Fichier de route introuvable : "%s"', $routesFile)); |
|
270 | + logger()->warning(sprintf('Fichier de route introuvable : "%s"', $routesFile)); |
|
271 | 271 | |
272 | 272 | continue; |
273 | 273 | } |
@@ -289,11 +289,11 @@ discard block |
||
289 | 289 | $this->routes = $this->routesNames = ['*' => []]; |
290 | 290 | |
291 | 291 | foreach ($this->defaultHTTPMethods as $verb) { |
292 | - $this->routes[$verb] = []; |
|
293 | - $this->routesNames[$verb] = []; |
|
292 | + $this->routes[$verb] = []; |
|
293 | + $this->routesNames[$verb] = []; |
|
294 | 294 | } |
295 | 295 | |
296 | - $this->routesOptions = []; |
|
296 | + $this->routesOptions = []; |
|
297 | 297 | |
298 | 298 | $this->prioritizeDetected = false; |
299 | 299 | $this->didDiscover = false; |
@@ -543,9 +543,9 @@ discard block |
||
543 | 543 | if (isset($this->routes[$verb])) { |
544 | 544 | // Conserve les itinéraires du verbe actuel au début afin qu'ils soient |
545 | 545 | // mis en correspondance avant l'un des itinéraires génériques "add". |
546 | - $collection = $includeWildcard ? $this->routes[$verb] + ($this->routes['*'] ?? []) : $this->routes[$verb]; |
|
546 | + $collection = $includeWildcard ? $this->routes[$verb] + ($this->routes['*'] ?? []) : $this->routes[$verb]; |
|
547 | 547 | |
548 | - foreach ($collection as $routeKey => $r) { |
|
548 | + foreach ($collection as $routeKey => $r) { |
|
549 | 549 | $routes[$routeKey] = $r['handler']; |
550 | 550 | } |
551 | 551 | } |
@@ -632,7 +632,7 @@ discard block |
||
632 | 632 | { |
633 | 633 | // Utilisez le modèle de la route nommée s'il s'agit d'une route nommée. |
634 | 634 | if (array_key_exists($to, $this->routesNames['*'])) { |
635 | - $routeName = $to; |
|
635 | + $routeName = $to; |
|
636 | 636 | $routeKey = $this->routesNames['*'][$routeName]; |
637 | 637 | $redirectTo = [$routeKey => $this->routes['*'][$routeKey]['handler']]; |
638 | 638 | |
@@ -652,18 +652,18 @@ discard block |
||
652 | 652 | |
653 | 653 | /** |
654 | 654 | * {@inheritDoc} |
655 | - * |
|
656 | - * @param string $routeKey cle de route ou route nommee |
|
655 | + * |
|
656 | + * @param string $routeKey cle de route ou route nommee |
|
657 | 657 | */ |
658 | 658 | public function isRedirect(string $routeKey): bool |
659 | 659 | { |
660 | - return isset($this->routes['*'][$routeKey]['redirect']); |
|
660 | + return isset($this->routes['*'][$routeKey]['redirect']); |
|
661 | 661 | } |
662 | 662 | |
663 | 663 | /** |
664 | 664 | * {@inheritDoc} |
665 | - * |
|
666 | - * @param string $routeKey cle de route ou route nommee |
|
665 | + * |
|
666 | + * @param string $routeKey cle de route ou route nommee |
|
667 | 667 | */ |
668 | 668 | public function getRedirectCode(string $routeKey): int |
669 | 669 | { |
@@ -786,59 +786,59 @@ discard block |
||
786 | 786 | } |
787 | 787 | } |
788 | 788 | |
789 | - $routeName = $name; |
|
790 | - if (isset($options['as']) || isset($options['name'])) { |
|
791 | - $routeName = trim($options['as'] ?? $options['name'], " ."); |
|
792 | - unset($options['name'], $options['as']); |
|
793 | - } |
|
789 | + $routeName = $name; |
|
790 | + if (isset($options['as']) || isset($options['name'])) { |
|
791 | + $routeName = trim($options['as'] ?? $options['name'], " ."); |
|
792 | + unset($options['name'], $options['as']); |
|
793 | + } |
|
794 | 794 | |
795 | 795 | if (in_array('index', $methods, true)) { |
796 | 796 | $this->get($name, $newName . '::index', $options + [ |
797 | - 'as' => $routeName . '.index', |
|
798 | - ]); |
|
797 | + 'as' => $routeName . '.index', |
|
798 | + ]); |
|
799 | 799 | } |
800 | 800 | if (in_array('new', $methods, true)) { |
801 | 801 | $this->get($name . '/new', $newName . '::new', $options + [ |
802 | - 'as' => $routeName . '.new', |
|
803 | - ]); |
|
802 | + 'as' => $routeName . '.new', |
|
803 | + ]); |
|
804 | 804 | } |
805 | 805 | if (in_array('edit', $methods, true)) { |
806 | 806 | $this->get($name . '/' . $id . '/edit', $newName . '::edit/$1', $options + [ |
807 | - 'as' => $routeName . '.edit', |
|
808 | - ]); |
|
807 | + 'as' => $routeName . '.edit', |
|
808 | + ]); |
|
809 | 809 | } |
810 | 810 | if (in_array('show', $methods, true)) { |
811 | 811 | $this->get($name . '/' . $id, $newName . '::show/$1', $options + [ |
812 | - 'as' => $routeName . '.show', |
|
813 | - ]); |
|
812 | + 'as' => $routeName . '.show', |
|
813 | + ]); |
|
814 | 814 | } |
815 | 815 | if (in_array('create', $methods, true)) { |
816 | 816 | $this->post($name, $newName . '::create', $options + [ |
817 | - 'as' => $routeName . '.create', |
|
818 | - ]); |
|
817 | + 'as' => $routeName . '.create', |
|
818 | + ]); |
|
819 | 819 | } |
820 | 820 | if (in_array('update', $methods, true)) { |
821 | - $this->match(['put', 'patch'], $name . '/' . $id, $newName . '::update/$1', $options + [ |
|
822 | - 'as' => $routeName . '.update', |
|
823 | - ]); |
|
821 | + $this->match(['put', 'patch'], $name . '/' . $id, $newName . '::update/$1', $options + [ |
|
822 | + 'as' => $routeName . '.update', |
|
823 | + ]); |
|
824 | 824 | } |
825 | 825 | if (in_array('delete', $methods, true)) { |
826 | 826 | $this->delete($name . '/' . $id, $newName . '::delete/$1', $options + [ |
827 | - 'as' => $routeName . '.delete', |
|
828 | - ]); |
|
827 | + 'as' => $routeName . '.delete', |
|
828 | + ]); |
|
829 | 829 | } |
830 | 830 | |
831 | 831 | // Websafe ? la suppression doit être vérifiée avant la mise à jour en raison du nom de la méthode |
832 | 832 | if (isset($options['websafe'])) { |
833 | 833 | if (in_array('delete', $methods, true)) { |
834 | 834 | $this->post($name . '/' . $id . '/delete', $newName . '::delete/$1', $options + [ |
835 | - 'as' => $routeName . '.websafe.delete', |
|
836 | - ]); |
|
835 | + 'as' => $routeName . '.websafe.delete', |
|
836 | + ]); |
|
837 | 837 | } |
838 | 838 | if (in_array('update', $methods, true)) { |
839 | 839 | $this->post($name . '/' . $id, $newName . '::update/$1', $options + [ |
840 | - 'as' => $routeName . '.websafe.update', |
|
841 | - ]); |
|
840 | + 'as' => $routeName . '.websafe.update', |
|
841 | + ]); |
|
842 | 842 | } |
843 | 843 | } |
844 | 844 | |
@@ -903,57 +903,57 @@ discard block |
||
903 | 903 | } |
904 | 904 | } |
905 | 905 | |
906 | - $routeName = $name; |
|
907 | - if (isset($options['as']) || isset($options['name'])) { |
|
908 | - $routeName = trim($options['as'] ?? $options['name'], " ."); |
|
909 | - unset($options['name'], $options['as']); |
|
910 | - } |
|
906 | + $routeName = $name; |
|
907 | + if (isset($options['as']) || isset($options['name'])) { |
|
908 | + $routeName = trim($options['as'] ?? $options['name'], " ."); |
|
909 | + unset($options['name'], $options['as']); |
|
910 | + } |
|
911 | 911 | |
912 | 912 | if (in_array('index', $methods, true)) { |
913 | 913 | $this->get($name, $newName . '::index', $options + [ |
914 | - 'as' => $routeName . '.index', |
|
915 | - ]); |
|
914 | + 'as' => $routeName . '.index', |
|
915 | + ]); |
|
916 | 916 | } |
917 | 917 | if (in_array('show', $methods, true)) { |
918 | 918 | $this->get($name . '/show/' . $id, $newName . '::show/$1', $options + [ |
919 | - 'as' => $routeName . '.view' |
|
920 | - ]); |
|
921 | - $this->get($name . '/' . $id, $newName . '::show/$1', $options + [ |
|
922 | - 'as' => $routeName . '.show' |
|
923 | - ]); |
|
919 | + 'as' => $routeName . '.view' |
|
920 | + ]); |
|
921 | + $this->get($name . '/' . $id, $newName . '::show/$1', $options + [ |
|
922 | + 'as' => $routeName . '.show' |
|
923 | + ]); |
|
924 | 924 | } |
925 | 925 | if (in_array('new', $methods, true)) { |
926 | 926 | $this->get($name . '/new', $newName . '::new', $options + [ |
927 | - 'as' => $routeName . '.new' |
|
928 | - ]); |
|
927 | + 'as' => $routeName . '.new' |
|
928 | + ]); |
|
929 | 929 | } |
930 | 930 | if (in_array('create', $methods, true)) { |
931 | 931 | $this->post($name . '/create', $newName . '::create', $options + [ |
932 | - 'as' => $routeName . '.create' |
|
933 | - ]); |
|
934 | - $this->post($name, $newName . '::create', $options + [ |
|
935 | - 'as' => $routeName . '.store' |
|
936 | - ]); |
|
932 | + 'as' => $routeName . '.create' |
|
933 | + ]); |
|
934 | + $this->post($name, $newName . '::create', $options + [ |
|
935 | + 'as' => $routeName . '.store' |
|
936 | + ]); |
|
937 | 937 | } |
938 | 938 | if (in_array('edit', $methods, true)) { |
939 | 939 | $this->get($name . '/edit/' . $id, $newName . '::edit/$1', $options + [ |
940 | - 'as' => $routeName . '.edit' |
|
941 | - ]); |
|
940 | + 'as' => $routeName . '.edit' |
|
941 | + ]); |
|
942 | 942 | } |
943 | 943 | if (in_array('update', $methods, true)) { |
944 | 944 | $this->post($name . '/update/' . $id, $newName . '::update/$1', $options + [ |
945 | - 'as' => $routeName . '.update', |
|
946 | - ]); |
|
945 | + 'as' => $routeName . '.update', |
|
946 | + ]); |
|
947 | 947 | } |
948 | 948 | if (in_array('remove', $methods, true)) { |
949 | 949 | $this->get($name . '/remove/' . $id, $newName . '::remove/$1', $options + [ |
950 | - 'as' => $routeName . '.remove', |
|
951 | - ]); |
|
950 | + 'as' => $routeName . '.remove', |
|
951 | + ]); |
|
952 | 952 | } |
953 | 953 | if (in_array('delete', $methods, true)) { |
954 | 954 | $this->post($name . '/delete/' . $id, $newName . '::delete/$1', $options + [ |
955 | - 'as' => $routeName . '.delete', |
|
956 | - ]); |
|
955 | + 'as' => $routeName . '.delete', |
|
956 | + ]); |
|
957 | 957 | } |
958 | 958 | |
959 | 959 | return $this; |
@@ -1067,17 +1067,17 @@ discard block |
||
1067 | 1067 | } |
1068 | 1068 | |
1069 | 1069 | |
1070 | - /** |
|
1070 | + /** |
|
1071 | 1071 | * Spécifie une route qui n'est disponible que pour les requêtes GET et POST. |
1072 | 1072 | * |
1073 | 1073 | * @param array|Closure|string $to |
1074 | 1074 | */ |
1075 | - public function form(string $from, $to, ?array $options = null): self |
|
1076 | - { |
|
1077 | - return $this->match(['GET', 'POST'], $from, $to, $options); |
|
1078 | - } |
|
1075 | + public function form(string $from, $to, ?array $options = null): self |
|
1076 | + { |
|
1077 | + return $this->match(['GET', 'POST'], $from, $to, $options); |
|
1078 | + } |
|
1079 | 1079 | |
1080 | - /** |
|
1080 | + /** |
|
1081 | 1081 | * Spécifie une route qui n'est disponible que pour les requêtes de ligne de commande. |
1082 | 1082 | * |
1083 | 1083 | * @param array|Closure|string $to |
@@ -1101,10 +1101,10 @@ discard block |
||
1101 | 1101 | ->setOptions($options) |
1102 | 1102 | ->render(); |
1103 | 1103 | |
1104 | - $routeOptions = $options ?? []; |
|
1105 | - $routeOptions = array_merge($routeOptions, ['view' => $view]); |
|
1104 | + $routeOptions = $options ?? []; |
|
1105 | + $routeOptions = array_merge($routeOptions, ['view' => $view]); |
|
1106 | 1106 | |
1107 | - $this->create('get', $from, $to, $routeOptions); |
|
1107 | + $this->create('get', $from, $to, $routeOptions); |
|
1108 | 1108 | |
1109 | 1109 | return $this; |
1110 | 1110 | } |
@@ -1360,7 +1360,7 @@ discard block |
||
1360 | 1360 | } |
1361 | 1361 | } |
1362 | 1362 | |
1363 | - $routeKey = $from; |
|
1363 | + $routeKey = $from; |
|
1364 | 1364 | |
1365 | 1365 | // Remplacez nos espaces réservés de regex par la chose réelle |
1366 | 1366 | // pour que le routeur n'ait pas besoin de savoir quoi que ce soit. |
@@ -1392,7 +1392,7 @@ discard block |
||
1392 | 1392 | return; |
1393 | 1393 | } |
1394 | 1394 | |
1395 | - $this->routes[$verb][$routeKey] = [ |
|
1395 | + $this->routes[$verb][$routeKey] = [ |
|
1396 | 1396 | 'name' => $name, |
1397 | 1397 | 'handler' => $to, |
1398 | 1398 | 'from' => $from, |
@@ -1495,15 +1495,15 @@ discard block |
||
1495 | 1495 | return array_shift($host); |
1496 | 1496 | } |
1497 | 1497 | |
1498 | - /** |
|
1499 | - * Formate le nom des routes |
|
1500 | - */ |
|
1501 | - private function formatRouteName(string $name): string |
|
1502 | - { |
|
1503 | - $name = trim($name, '/'); |
|
1498 | + /** |
|
1499 | + * Formate le nom des routes |
|
1500 | + */ |
|
1501 | + private function formatRouteName(string $name): string |
|
1502 | + { |
|
1503 | + $name = trim($name, '/'); |
|
1504 | 1504 | |
1505 | - return strtolower(str_replace(['/', '\\', '_', '.', ' '], '.', $name)); |
|
1506 | - } |
|
1505 | + return strtolower(str_replace(['/', '\\', '_', '.', ' '], '.', $name)); |
|
1506 | + } |
|
1507 | 1507 | |
1508 | 1508 | private function getControllerName(Closure|string $handler): ?string |
1509 | 1509 | { |
@@ -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 | } |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * the LICENSE file that was distributed with this source code. |
10 | 10 | */ |
11 | 11 | |
12 | -if (! function_exists('css_path')) { |
|
12 | +if (!function_exists('css_path')) { |
|
13 | 13 | /** |
14 | 14 | * CSS PATH |
15 | 15 | * |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | */ |
20 | 20 | function css_path(string $name = ''): string |
21 | 21 | { |
22 | - if (! empty($name)) { |
|
22 | + if (!empty($name)) { |
|
23 | 23 | $name = DS . ltrim($name, '/\\'); |
24 | 24 | } |
25 | 25 | |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | } |
28 | 28 | } |
29 | 29 | |
30 | -if (! function_exists('js_path')) { |
|
30 | +if (!function_exists('js_path')) { |
|
31 | 31 | /** |
32 | 32 | * JS PATH |
33 | 33 | * |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | */ |
38 | 38 | function js_path(string $name = ''): string |
39 | 39 | { |
40 | - if (! empty($name)) { |
|
40 | + if (!empty($name)) { |
|
41 | 41 | $name = DS . ltrim($name, '/\\'); |
42 | 42 | } |
43 | 43 | |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | } |
46 | 46 | } |
47 | 47 | |
48 | -if (! function_exists('lib_path')) { |
|
48 | +if (!function_exists('lib_path')) { |
|
49 | 49 | /** |
50 | 50 | * LIB PATH |
51 | 51 | * |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | */ |
56 | 56 | function lib_path(string $name = ''): string |
57 | 57 | { |
58 | - if (! empty($name)) { |
|
58 | + if (!empty($name)) { |
|
59 | 59 | $name = DS . ltrim($name, '/\\'); |
60 | 60 | } |
61 | 61 | |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | } |
64 | 64 | } |
65 | 65 | |
66 | -if (! function_exists('less_path')) { |
|
66 | +if (!function_exists('less_path')) { |
|
67 | 67 | /** |
68 | 68 | * LESS PATH |
69 | 69 | * |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | */ |
74 | 74 | function less_path(string $name = ''): string |
75 | 75 | { |
76 | - if (! empty($name)) { |
|
76 | + if (!empty($name)) { |
|
77 | 77 | $name = DS . ltrim($name, '/\\'); |
78 | 78 | } |
79 | 79 | |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | } |
82 | 82 | } |
83 | 83 | |
84 | -if (! function_exists('img_path')) { |
|
84 | +if (!function_exists('img_path')) { |
|
85 | 85 | /** |
86 | 86 | * IMG PATH |
87 | 87 | * |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | */ |
92 | 92 | function img_path(string $name = ''): string |
93 | 93 | { |
94 | - if (! empty($name)) { |
|
94 | + if (!empty($name)) { |
|
95 | 95 | $name = DS . ltrim($name, '/\\'); |
96 | 96 | } |
97 | 97 | |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | } |
100 | 100 | } |
101 | 101 | |
102 | -if (! function_exists('docs_path')) { |
|
102 | +if (!function_exists('docs_path')) { |
|
103 | 103 | /** |
104 | 104 | * DOCS PATH |
105 | 105 | * |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | */ |
110 | 110 | function docs_path(string $name = ''): string |
111 | 111 | { |
112 | - if (! empty($name)) { |
|
112 | + if (!empty($name)) { |
|
113 | 113 | $name = DS . ltrim($name, '/\\'); |
114 | 114 | } |
115 | 115 | |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | } |
118 | 118 | } |
119 | 119 | |
120 | -if (! function_exists('video_path')) { |
|
120 | +if (!function_exists('video_path')) { |
|
121 | 121 | /** |
122 | 122 | * VIDEO PATH |
123 | 123 | * |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | */ |
128 | 128 | function video_path(string $name = ''): string |
129 | 129 | { |
130 | - if (! empty($name)) { |
|
130 | + if (!empty($name)) { |
|
131 | 131 | $name = DS . ltrim($name, '/\\'); |
132 | 132 | } |
133 | 133 | |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | } |
136 | 136 | } |
137 | 137 | |
138 | -if (! function_exists('public_path')) { |
|
138 | +if (!function_exists('public_path')) { |
|
139 | 139 | /** |
140 | 140 | * PUBLIC PATH |
141 | 141 | * |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | */ |
146 | 146 | function public_path(string $name = ''): string |
147 | 147 | { |
148 | - if (! empty($name)) { |
|
148 | + if (!empty($name)) { |
|
149 | 149 | $name = ltrim($name, '/\\'); |
150 | 150 | } |
151 | 151 | |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | } |
154 | 154 | } |
155 | 155 | |
156 | -if (! function_exists('root_path')) { |
|
156 | +if (!function_exists('root_path')) { |
|
157 | 157 | /** |
158 | 158 | * ROOT PATH |
159 | 159 | * |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | */ |
164 | 164 | function root_path(string $name = ''): string |
165 | 165 | { |
166 | - if (! empty($name)) { |
|
166 | + if (!empty($name)) { |
|
167 | 167 | $name = ltrim($name, '/\\'); |
168 | 168 | } |
169 | 169 | |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | } |
172 | 172 | } |
173 | 173 | |
174 | -if (! function_exists('base_path')) { |
|
174 | +if (!function_exists('base_path')) { |
|
175 | 175 | /** |
176 | 176 | * BASE PATH |
177 | 177 | * |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | */ |
182 | 182 | function base_path(string $name = ''): string |
183 | 183 | { |
184 | - if (! empty($name)) { |
|
184 | + if (!empty($name)) { |
|
185 | 185 | $name = ltrim($name, '/\\'); |
186 | 186 | } |
187 | 187 | |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | } |
190 | 190 | } |
191 | 191 | |
192 | -if (! function_exists('resource_path')) { |
|
192 | +if (!function_exists('resource_path')) { |
|
193 | 193 | /** |
194 | 194 | * BASE RESOURCE PATH |
195 | 195 | * |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | */ |
200 | 200 | function resource_path(string $name = ''): string |
201 | 201 | { |
202 | - if (! empty($name)) { |
|
202 | + if (!empty($name)) { |
|
203 | 203 | $name = ltrim($name, '/\\'); |
204 | 204 | } |
205 | 205 | |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | } |
208 | 208 | } |
209 | 209 | |
210 | -if (! function_exists('class_path')) { |
|
210 | +if (!function_exists('class_path')) { |
|
211 | 211 | /** |
212 | 212 | * CLASS PATH |
213 | 213 | * |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | */ |
218 | 218 | function class_path(string $name = ''): string |
219 | 219 | { |
220 | - if (! empty($name)) { |
|
220 | + if (!empty($name)) { |
|
221 | 221 | $name = DS . ltrim($name, '/\\'); |
222 | 222 | } |
223 | 223 | |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | } |
226 | 226 | } |
227 | 227 | |
228 | -if (! function_exists('config_path')) { |
|
228 | +if (!function_exists('config_path')) { |
|
229 | 229 | /** |
230 | 230 | * CONFIG PATH |
231 | 231 | * |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | */ |
236 | 236 | function config_path(string $name = ''): string |
237 | 237 | { |
238 | - if (! empty($name)) { |
|
238 | + if (!empty($name)) { |
|
239 | 239 | $name = DS . ltrim($name, '/\\'); |
240 | 240 | } |
241 | 241 | |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | } |
244 | 244 | } |
245 | 245 | |
246 | -if (! function_exists('controller_path')) { |
|
246 | +if (!function_exists('controller_path')) { |
|
247 | 247 | /** |
248 | 248 | * CONTROLLER PATH |
249 | 249 | * |
@@ -254,10 +254,10 @@ discard block |
||
254 | 254 | */ |
255 | 255 | function controller_path(string $name = '', bool $only = true): string |
256 | 256 | { |
257 | - if (! empty($name)) { |
|
257 | + if (!empty($name)) { |
|
258 | 258 | $name = ltrim($name, '/\\'); |
259 | 259 | |
260 | - if ($only === true && ! preg_match('#Controller\.php$#', $name)) { |
|
260 | + if ($only === true && !preg_match('#Controller\.php$#', $name)) { |
|
261 | 261 | $name = ucfirst(strtolower($name)) . 'Controller.php'; |
262 | 262 | } |
263 | 263 | } |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | } |
267 | 267 | } |
268 | 268 | |
269 | -if (! function_exists('entity_path')) { |
|
269 | +if (!function_exists('entity_path')) { |
|
270 | 270 | /** |
271 | 271 | * ENTITY PATH |
272 | 272 | * |
@@ -277,10 +277,10 @@ discard block |
||
277 | 277 | */ |
278 | 278 | function entity_path(string $name = '', bool $only = true): string |
279 | 279 | { |
280 | - if (! empty($name)) { |
|
280 | + if (!empty($name)) { |
|
281 | 281 | $name = ltrim($name, '/\\'); |
282 | 282 | |
283 | - if ($only === true && ! preg_match('#Entity\.php$#', $name)) { |
|
283 | + if ($only === true && !preg_match('#Entity\.php$#', $name)) { |
|
284 | 284 | $name = ucfirst($name) . 'Entity.php'; |
285 | 285 | } |
286 | 286 | } |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | } |
290 | 290 | } |
291 | 291 | |
292 | -if (! function_exists('helper_path')) { |
|
292 | +if (!function_exists('helper_path')) { |
|
293 | 293 | /** |
294 | 294 | * HELPER PATH |
295 | 295 | * |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | */ |
301 | 301 | function helper_path(string $name = '', bool $system = false): string |
302 | 302 | { |
303 | - if (! empty($name)) { |
|
303 | + if (!empty($name)) { |
|
304 | 304 | $name = DS . ltrim($name, '/\\'); |
305 | 305 | } |
306 | 306 | if ($system === true) { |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | } |
312 | 312 | } |
313 | 313 | |
314 | -if (! function_exists('library_path')) { |
|
314 | +if (!function_exists('library_path')) { |
|
315 | 315 | /** |
316 | 316 | * LIBRARY PATH |
317 | 317 | * |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | */ |
323 | 323 | function library_path(string $name = '', bool $system = false): string |
324 | 324 | { |
325 | - if (! empty($name)) { |
|
325 | + if (!empty($name)) { |
|
326 | 326 | $name = DS . ltrim($name, '/\\'); |
327 | 327 | } |
328 | 328 | if ($system === true) { |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | } |
334 | 334 | } |
335 | 335 | |
336 | -if (! function_exists('middleware_path')) { |
|
336 | +if (!function_exists('middleware_path')) { |
|
337 | 337 | /** |
338 | 338 | * MIDDLEWARE PATH |
339 | 339 | * |
@@ -345,10 +345,10 @@ discard block |
||
345 | 345 | */ |
346 | 346 | function middleware_path(string $name = '', bool $system = false, bool $only = true): string |
347 | 347 | { |
348 | - if (! empty($name)) { |
|
348 | + if (!empty($name)) { |
|
349 | 349 | $name = DS . ltrim($name, '/\\'); |
350 | 350 | |
351 | - if ($only === true && ! preg_match('#Middleware\.php$#', $name)) { |
|
351 | + if ($only === true && !preg_match('#Middleware\.php$#', $name)) { |
|
352 | 352 | $name = ucfirst($name) . 'Middleware.php'; |
353 | 353 | } |
354 | 354 | } |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | } |
361 | 361 | } |
362 | 362 | |
363 | -if (! function_exists('model_path')) { |
|
363 | +if (!function_exists('model_path')) { |
|
364 | 364 | /** |
365 | 365 | * MODEL PATH |
366 | 366 | * |
@@ -371,10 +371,10 @@ discard block |
||
371 | 371 | */ |
372 | 372 | function model_path(string $name = '', bool $only = true): string |
373 | 373 | { |
374 | - if (! empty($name)) { |
|
374 | + if (!empty($name)) { |
|
375 | 375 | $name = ltrim($name, '/\\'); |
376 | 376 | |
377 | - if ($only === true && ! preg_match('#Model\.php$#', $name)) { |
|
377 | + if ($only === true && !preg_match('#Model\.php$#', $name)) { |
|
378 | 378 | $name = ucfirst(strtolower($name)) . 'Model.php'; |
379 | 379 | } |
380 | 380 | } |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | } |
384 | 384 | } |
385 | 385 | |
386 | -if (! function_exists('app_resource_path')) { |
|
386 | +if (!function_exists('app_resource_path')) { |
|
387 | 387 | /** |
388 | 388 | * APP RESOURCE PATH |
389 | 389 | * |
@@ -393,7 +393,7 @@ discard block |
||
393 | 393 | */ |
394 | 394 | function app_resource_path(string $name = ''): string |
395 | 395 | { |
396 | - if (! empty($name)) { |
|
396 | + if (!empty($name)) { |
|
397 | 397 | $name = ltrim($name, '/\\'); |
398 | 398 | } |
399 | 399 | |
@@ -401,7 +401,7 @@ discard block |
||
401 | 401 | } |
402 | 402 | } |
403 | 403 | |
404 | -if (! function_exists('migration_path')) { |
|
404 | +if (!function_exists('migration_path')) { |
|
405 | 405 | /** |
406 | 406 | * MIGRATION PATH |
407 | 407 | * |
@@ -411,7 +411,7 @@ discard block |
||
411 | 411 | */ |
412 | 412 | function migration_path(string $name = ''): string |
413 | 413 | { |
414 | - if (! empty($name)) { |
|
414 | + if (!empty($name)) { |
|
415 | 415 | $name = ltrim($name, '/\\'); |
416 | 416 | } |
417 | 417 | |
@@ -419,7 +419,7 @@ discard block |
||
419 | 419 | } |
420 | 420 | } |
421 | 421 | |
422 | -if (! function_exists('seed_path')) { |
|
422 | +if (!function_exists('seed_path')) { |
|
423 | 423 | /** |
424 | 424 | * SEED PATH |
425 | 425 | * |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | */ |
430 | 430 | function seed_path(string $name = ''): string |
431 | 431 | { |
432 | - if (! empty($name)) { |
|
432 | + if (!empty($name)) { |
|
433 | 433 | $name = ltrim($name, '/\\'); |
434 | 434 | } |
435 | 435 | |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | } |
438 | 438 | } |
439 | 439 | |
440 | -if (! function_exists('lang_path')) { |
|
440 | +if (!function_exists('lang_path')) { |
|
441 | 441 | /** |
442 | 442 | * LANG PATH |
443 | 443 | * |
@@ -448,7 +448,7 @@ discard block |
||
448 | 448 | */ |
449 | 449 | function lang_path(string $name = '', bool $system = false): string |
450 | 450 | { |
451 | - if (! empty($name)) { |
|
451 | + if (!empty($name)) { |
|
452 | 452 | $name = DS . ltrim($name, '/\\'); |
453 | 453 | } |
454 | 454 | if ($system === true) { |
@@ -459,7 +459,7 @@ discard block |
||
459 | 459 | } |
460 | 460 | } |
461 | 461 | |
462 | -if (! function_exists('service_path')) { |
|
462 | +if (!function_exists('service_path')) { |
|
463 | 463 | /** |
464 | 464 | * SERVICE PATH |
465 | 465 | * |
@@ -470,10 +470,10 @@ discard block |
||
470 | 470 | */ |
471 | 471 | function service_path(string $name = '', bool $only = true): string |
472 | 472 | { |
473 | - if (! empty($name)) { |
|
473 | + if (!empty($name)) { |
|
474 | 474 | $name = ltrim($name, '/\\'); |
475 | 475 | |
476 | - if ($only === true && ! preg_match('#Service\.php$#', $name)) { |
|
476 | + if ($only === true && !preg_match('#Service\.php$#', $name)) { |
|
477 | 477 | $name = ucfirst($name) . 'Service.php'; |
478 | 478 | } |
479 | 479 | } |
@@ -482,7 +482,7 @@ discard block |
||
482 | 482 | } |
483 | 483 | } |
484 | 484 | |
485 | -if (! function_exists('view_path')) { |
|
485 | +if (!function_exists('view_path')) { |
|
486 | 486 | /** |
487 | 487 | * VIEW PATH |
488 | 488 | * |
@@ -492,7 +492,7 @@ discard block |
||
492 | 492 | */ |
493 | 493 | function view_path(string $name = ''): string |
494 | 494 | { |
495 | - if (! empty($name)) { |
|
495 | + if (!empty($name)) { |
|
496 | 496 | $name = ltrim($name, '/\\'); |
497 | 497 | } |
498 | 498 | |
@@ -500,7 +500,7 @@ discard block |
||
500 | 500 | } |
501 | 501 | } |
502 | 502 | |
503 | -if (! function_exists('layout_path')) { |
|
503 | +if (!function_exists('layout_path')) { |
|
504 | 504 | /** |
505 | 505 | * LAYOUT PATH |
506 | 506 | * |
@@ -510,7 +510,7 @@ discard block |
||
510 | 510 | */ |
511 | 511 | function layout_path(string $name = ''): string |
512 | 512 | { |
513 | - if (! empty($name)) { |
|
513 | + if (!empty($name)) { |
|
514 | 514 | $name = ltrim($name, '/\\'); |
515 | 515 | } |
516 | 516 | |
@@ -518,7 +518,7 @@ discard block |
||
518 | 518 | } |
519 | 519 | } |
520 | 520 | |
521 | -if (! function_exists('partial_path')) { |
|
521 | +if (!function_exists('partial_path')) { |
|
522 | 522 | /** |
523 | 523 | * PARTIAL PATH |
524 | 524 | * |
@@ -528,7 +528,7 @@ discard block |
||
528 | 528 | */ |
529 | 529 | function partial_path(string $name = ''): string |
530 | 530 | { |
531 | - if (! empty($name)) { |
|
531 | + if (!empty($name)) { |
|
532 | 532 | $name = DS . ltrim($name, '/\\'); |
533 | 533 | } |
534 | 534 | |
@@ -536,7 +536,7 @@ discard block |
||
536 | 536 | } |
537 | 537 | } |
538 | 538 | |
539 | -if (! function_exists('app_path')) { |
|
539 | +if (!function_exists('app_path')) { |
|
540 | 540 | /** |
541 | 541 | * APP PATH |
542 | 542 | * |
@@ -546,7 +546,7 @@ discard block |
||
546 | 546 | */ |
547 | 547 | function app_path(string $name = ''): string |
548 | 548 | { |
549 | - if (! empty($name)) { |
|
549 | + if (!empty($name)) { |
|
550 | 550 | $name = ltrim($name, '/\\'); |
551 | 551 | } |
552 | 552 | |
@@ -554,7 +554,7 @@ discard block |
||
554 | 554 | } |
555 | 555 | } |
556 | 556 | |
557 | -if (! function_exists('cache_path')) { |
|
557 | +if (!function_exists('cache_path')) { |
|
558 | 558 | /** |
559 | 559 | * CACHE PATH |
560 | 560 | * |
@@ -564,7 +564,7 @@ discard block |
||
564 | 564 | */ |
565 | 565 | function cache_path(string $name = ''): string |
566 | 566 | { |
567 | - if (! empty($name)) { |
|
567 | + if (!empty($name)) { |
|
568 | 568 | $name = ltrim($name, '/\\'); |
569 | 569 | } |
570 | 570 | |
@@ -572,7 +572,7 @@ discard block |
||
572 | 572 | } |
573 | 573 | } |
574 | 574 | |
575 | -if (! function_exists('dump_path')) { |
|
575 | +if (!function_exists('dump_path')) { |
|
576 | 576 | /** |
577 | 577 | * DUMP PATH |
578 | 578 | * |
@@ -582,7 +582,7 @@ discard block |
||
582 | 582 | */ |
583 | 583 | function dump_path(string $name = ''): string |
584 | 584 | { |
585 | - if (! empty($name)) { |
|
585 | + if (!empty($name)) { |
|
586 | 586 | $name = ltrim($name, '/\\'); |
587 | 587 | } |
588 | 588 | |
@@ -590,7 +590,7 @@ discard block |
||
590 | 590 | } |
591 | 591 | } |
592 | 592 | |
593 | -if (! function_exists('storage_path')) { |
|
593 | +if (!function_exists('storage_path')) { |
|
594 | 594 | /** |
595 | 595 | * STORAGE PATH |
596 | 596 | * |
@@ -600,7 +600,7 @@ discard block |
||
600 | 600 | */ |
601 | 601 | function storage_path(string $name = ''): string |
602 | 602 | { |
603 | - if (! empty($name)) { |
|
603 | + if (!empty($name)) { |
|
604 | 604 | $name = ltrim($name, '/\\'); |
605 | 605 | } |
606 | 606 | |
@@ -608,7 +608,7 @@ discard block |
||
608 | 608 | } |
609 | 609 | } |
610 | 610 | |
611 | -if (! function_exists('css_exist')) { |
|
611 | +if (!function_exists('css_exist')) { |
|
612 | 612 | /** |
613 | 613 | * CSS EXIST |
614 | 614 | * |
@@ -622,7 +622,7 @@ discard block |
||
622 | 622 | } |
623 | 623 | } |
624 | 624 | |
625 | -if (! function_exists('js_exist')) { |
|
625 | +if (!function_exists('js_exist')) { |
|
626 | 626 | /** |
627 | 627 | * JS EXIST |
628 | 628 | * |
@@ -636,7 +636,7 @@ discard block |
||
636 | 636 | } |
637 | 637 | } |
638 | 638 | |
639 | -if (! function_exists('lib_exist')) { |
|
639 | +if (!function_exists('lib_exist')) { |
|
640 | 640 | /** |
641 | 641 | * LIB EXIST |
642 | 642 | * |
@@ -650,7 +650,7 @@ discard block |
||
650 | 650 | } |
651 | 651 | } |
652 | 652 | |
653 | -if (! function_exists('less_exist')) { |
|
653 | +if (!function_exists('less_exist')) { |
|
654 | 654 | /** |
655 | 655 | * LESS EXIST |
656 | 656 | * |
@@ -664,7 +664,7 @@ discard block |
||
664 | 664 | } |
665 | 665 | } |
666 | 666 | |
667 | -if (! function_exists('img_exist')) { |
|
667 | +if (!function_exists('img_exist')) { |
|
668 | 668 | /** |
669 | 669 | * IMG EXIST |
670 | 670 | * |
@@ -678,7 +678,7 @@ discard block |
||
678 | 678 | } |
679 | 679 | } |
680 | 680 | |
681 | -if (! function_exists('doc_exist')) { |
|
681 | +if (!function_exists('doc_exist')) { |
|
682 | 682 | /** |
683 | 683 | * DOC EXIST |
684 | 684 | * |
@@ -692,7 +692,7 @@ discard block |
||
692 | 692 | } |
693 | 693 | } |
694 | 694 | |
695 | -if (! function_exists('video_exist')) { |
|
695 | +if (!function_exists('video_exist')) { |
|
696 | 696 | /** |
697 | 697 | * VIDEO EXIST |
698 | 698 | * |
@@ -706,7 +706,7 @@ discard block |
||
706 | 706 | } |
707 | 707 | } |
708 | 708 | |
709 | -if (! function_exists('public_exist')) { |
|
709 | +if (!function_exists('public_exist')) { |
|
710 | 710 | /** |
711 | 711 | * PUBLIC EXIST |
712 | 712 | * |
@@ -720,7 +720,7 @@ discard block |
||
720 | 720 | } |
721 | 721 | } |
722 | 722 | |
723 | -if (! function_exists('class_exist')) { |
|
723 | +if (!function_exists('class_exist')) { |
|
724 | 724 | /** |
725 | 725 | * CLASS EXIST |
726 | 726 | * |
@@ -734,7 +734,7 @@ discard block |
||
734 | 734 | } |
735 | 735 | } |
736 | 736 | |
737 | -if (! function_exists('config_exist')) { |
|
737 | +if (!function_exists('config_exist')) { |
|
738 | 738 | /** |
739 | 739 | * CONFIG EXIST |
740 | 740 | * |
@@ -748,7 +748,7 @@ discard block |
||
748 | 748 | } |
749 | 749 | } |
750 | 750 | |
751 | -if (! function_exists('controller_exist')) { |
|
751 | +if (!function_exists('controller_exist')) { |
|
752 | 752 | /** |
753 | 753 | * CONTROLLER EXIST |
754 | 754 | * |
@@ -763,7 +763,7 @@ discard block |
||
763 | 763 | } |
764 | 764 | } |
765 | 765 | |
766 | -if (! function_exists('entity_exist')) { |
|
766 | +if (!function_exists('entity_exist')) { |
|
767 | 767 | /** |
768 | 768 | * ENTITY EXIST |
769 | 769 | * |
@@ -778,7 +778,7 @@ discard block |
||
778 | 778 | } |
779 | 779 | } |
780 | 780 | |
781 | -if (! function_exists('helper_exist')) { |
|
781 | +if (!function_exists('helper_exist')) { |
|
782 | 782 | /** |
783 | 783 | * HELPER EXIST |
784 | 784 | * |
@@ -793,7 +793,7 @@ discard block |
||
793 | 793 | } |
794 | 794 | } |
795 | 795 | |
796 | -if (! function_exists('library_exist')) { |
|
796 | +if (!function_exists('library_exist')) { |
|
797 | 797 | /** |
798 | 798 | * LIBRARY EXIST |
799 | 799 | * |
@@ -808,7 +808,7 @@ discard block |
||
808 | 808 | } |
809 | 809 | } |
810 | 810 | |
811 | -if (! function_exists('middleware_exist')) { |
|
811 | +if (!function_exists('middleware_exist')) { |
|
812 | 812 | /** |
813 | 813 | * MIDDLEWARE EXIST |
814 | 814 | * |
@@ -824,7 +824,7 @@ discard block |
||
824 | 824 | } |
825 | 825 | } |
826 | 826 | |
827 | -if (! function_exists('model_exist')) { |
|
827 | +if (!function_exists('model_exist')) { |
|
828 | 828 | /** |
829 | 829 | * MODEL EXIST |
830 | 830 | * |
@@ -839,7 +839,7 @@ discard block |
||
839 | 839 | } |
840 | 840 | } |
841 | 841 | |
842 | -if (! function_exists('resource_exist')) { |
|
842 | +if (!function_exists('resource_exist')) { |
|
843 | 843 | /** |
844 | 844 | * RESOURCE EXIST |
845 | 845 | * |
@@ -853,7 +853,7 @@ discard block |
||
853 | 853 | } |
854 | 854 | } |
855 | 855 | |
856 | -if (! function_exists('migration_exist')) { |
|
856 | +if (!function_exists('migration_exist')) { |
|
857 | 857 | /** |
858 | 858 | * MIGRATION EXIST |
859 | 859 | * |
@@ -867,7 +867,7 @@ discard block |
||
867 | 867 | } |
868 | 868 | } |
869 | 869 | |
870 | -if (! function_exists('seed_exist')) { |
|
870 | +if (!function_exists('seed_exist')) { |
|
871 | 871 | /** |
872 | 872 | * SEED EXIST |
873 | 873 | * |
@@ -881,7 +881,7 @@ discard block |
||
881 | 881 | } |
882 | 882 | } |
883 | 883 | |
884 | -if (! function_exists('lang_exist')) { |
|
884 | +if (!function_exists('lang_exist')) { |
|
885 | 885 | /** |
886 | 886 | * LANG EXIST |
887 | 887 | * |
@@ -896,7 +896,7 @@ discard block |
||
896 | 896 | } |
897 | 897 | } |
898 | 898 | |
899 | -if (! function_exists('service_exist')) { |
|
899 | +if (!function_exists('service_exist')) { |
|
900 | 900 | /** |
901 | 901 | * SERVICE EXIST |
902 | 902 | * |
@@ -911,7 +911,7 @@ discard block |
||
911 | 911 | } |
912 | 912 | } |
913 | 913 | |
914 | -if (! function_exists('view_exist')) { |
|
914 | +if (!function_exists('view_exist')) { |
|
915 | 915 | /** |
916 | 916 | * VIEW EXIST |
917 | 917 | * |
@@ -925,7 +925,7 @@ discard block |
||
925 | 925 | } |
926 | 926 | } |
927 | 927 | |
928 | -if (! function_exists('layout_exist')) { |
|
928 | +if (!function_exists('layout_exist')) { |
|
929 | 929 | /** |
930 | 930 | * LAYOUT EXIST |
931 | 931 | * |
@@ -939,7 +939,7 @@ discard block |
||
939 | 939 | } |
940 | 940 | } |
941 | 941 | |
942 | -if (! function_exists('partial_exist')) { |
|
942 | +if (!function_exists('partial_exist')) { |
|
943 | 943 | /** |
944 | 944 | * PARTIAL EXIST |
945 | 945 | * |
@@ -953,7 +953,7 @@ discard block |
||
953 | 953 | } |
954 | 954 | } |
955 | 955 | |
956 | -if (! function_exists('app_exist')) { |
|
956 | +if (!function_exists('app_exist')) { |
|
957 | 957 | /** |
958 | 958 | * APP EXIST |
959 | 959 | * |
@@ -967,7 +967,7 @@ discard block |
||
967 | 967 | } |
968 | 968 | } |
969 | 969 | |
970 | -if (! function_exists('cache_exist')) { |
|
970 | +if (!function_exists('cache_exist')) { |
|
971 | 971 | /** |
972 | 972 | * CACHE EXIST |
973 | 973 | * |
@@ -981,7 +981,7 @@ discard block |
||
981 | 981 | } |
982 | 982 | } |
983 | 983 | |
984 | -if (! function_exists('dump_exist')) { |
|
984 | +if (!function_exists('dump_exist')) { |
|
985 | 985 | /** |
986 | 986 | * DUMP EXIST |
987 | 987 | * |
@@ -995,7 +995,7 @@ discard block |
||
995 | 995 | } |
996 | 996 | } |
997 | 997 | |
998 | -if (! function_exists('storage_exist')) { |
|
998 | +if (!function_exists('storage_exist')) { |
|
999 | 999 | /** |
1000 | 1000 | * STORAGE EXIST |
1001 | 1001 | * |
@@ -1009,7 +1009,7 @@ discard block |
||
1009 | 1009 | } |
1010 | 1010 | } |
1011 | 1011 | |
1012 | -if (! function_exists('include_config')) { |
|
1012 | +if (!function_exists('include_config')) { |
|
1013 | 1013 | /** |
1014 | 1014 | * INCLUDE CONFIG |
1015 | 1015 | * |
@@ -1027,7 +1027,7 @@ discard block |
||
1027 | 1027 | } |
1028 | 1028 | } |
1029 | 1029 | |
1030 | -if (! function_exists('include_controller')) { |
|
1030 | +if (!function_exists('include_controller')) { |
|
1031 | 1031 | /** |
1032 | 1032 | * INCLUDE CONTROLLER |
1033 | 1033 | * |
@@ -1046,7 +1046,7 @@ discard block |
||
1046 | 1046 | } |
1047 | 1047 | } |
1048 | 1048 | |
1049 | -if (! function_exists('include_class')) { |
|
1049 | +if (!function_exists('include_class')) { |
|
1050 | 1050 | /** |
1051 | 1051 | * INCLUDE CLASS |
1052 | 1052 | * |
@@ -1064,7 +1064,7 @@ discard block |
||
1064 | 1064 | } |
1065 | 1065 | } |
1066 | 1066 | |
1067 | -if (! function_exists('include_entity')) { |
|
1067 | +if (!function_exists('include_entity')) { |
|
1068 | 1068 | /** |
1069 | 1069 | * INCLUDE ENTITY |
1070 | 1070 | * |
@@ -1083,7 +1083,7 @@ discard block |
||
1083 | 1083 | } |
1084 | 1084 | } |
1085 | 1085 | |
1086 | -if (! function_exists('include_helper')) { |
|
1086 | +if (!function_exists('include_helper')) { |
|
1087 | 1087 | /** |
1088 | 1088 | * INCLUDE HELPER |
1089 | 1089 | * |
@@ -1101,7 +1101,7 @@ discard block |
||
1101 | 1101 | } |
1102 | 1102 | } |
1103 | 1103 | |
1104 | -if (! function_exists('include_library')) { |
|
1104 | +if (!function_exists('include_library')) { |
|
1105 | 1105 | /** |
1106 | 1106 | * INCLUDE LIBRARY |
1107 | 1107 | * |
@@ -1120,7 +1120,7 @@ discard block |
||
1120 | 1120 | } |
1121 | 1121 | } |
1122 | 1122 | |
1123 | -if (! function_exists('include_middleware')) { |
|
1123 | +if (!function_exists('include_middleware')) { |
|
1124 | 1124 | /** |
1125 | 1125 | * INCLUDE MIDDLEWARE |
1126 | 1126 | * |
@@ -1140,7 +1140,7 @@ discard block |
||
1140 | 1140 | } |
1141 | 1141 | } |
1142 | 1142 | |
1143 | -if (! function_exists('include_model')) { |
|
1143 | +if (!function_exists('include_model')) { |
|
1144 | 1144 | /** |
1145 | 1145 | * INCLUDE MODEL |
1146 | 1146 | * |
@@ -1159,7 +1159,7 @@ discard block |
||
1159 | 1159 | } |
1160 | 1160 | } |
1161 | 1161 | |
1162 | -if (! function_exists('include_resource')) { |
|
1162 | +if (!function_exists('include_resource')) { |
|
1163 | 1163 | /** |
1164 | 1164 | * INCLUDE RESOURCE |
1165 | 1165 | * |
@@ -1177,7 +1177,7 @@ discard block |
||
1177 | 1177 | } |
1178 | 1178 | } |
1179 | 1179 | |
1180 | -if (! function_exists('include_service')) { |
|
1180 | +if (!function_exists('include_service')) { |
|
1181 | 1181 | /** |
1182 | 1182 | * INCLUDE SERVICE |
1183 | 1183 | * |
@@ -1196,7 +1196,7 @@ discard block |
||
1196 | 1196 | } |
1197 | 1197 | } |
1198 | 1198 | |
1199 | -if (! function_exists('include_view')) { |
|
1199 | +if (!function_exists('include_view')) { |
|
1200 | 1200 | /** |
1201 | 1201 | * INCLUDE VIEW |
1202 | 1202 | * |
@@ -1214,7 +1214,7 @@ discard block |
||
1214 | 1214 | } |
1215 | 1215 | } |
1216 | 1216 | |
1217 | -if (! function_exists('include_layout')) { |
|
1217 | +if (!function_exists('include_layout')) { |
|
1218 | 1218 | /** |
1219 | 1219 | * INCLUDE LAYOUT |
1220 | 1220 | * |
@@ -1232,7 +1232,7 @@ discard block |
||
1232 | 1232 | } |
1233 | 1233 | } |
1234 | 1234 | |
1235 | -if (! function_exists('include_partial')) { |
|
1235 | +if (!function_exists('include_partial')) { |
|
1236 | 1236 | /** |
1237 | 1237 | * INCLUDE PARTIAL |
1238 | 1238 | * |
@@ -1250,7 +1250,7 @@ discard block |
||
1250 | 1250 | } |
1251 | 1251 | } |
1252 | 1252 | |
1253 | -if (! function_exists('_include_path')) { |
|
1253 | +if (!function_exists('_include_path')) { |
|
1254 | 1254 | /** |
1255 | 1255 | * inclus un fichier |
1256 | 1256 | * |
@@ -107,35 +107,35 @@ discard block |
||
107 | 107 | */ |
108 | 108 | defined('LAYOUT_PATH') || define('LAYOUT_PATH', VIEW_PATH . 'layouts' . DS); |
109 | 109 | |
110 | -if (! defined('SERVICE_PATH')) { |
|
110 | +if (!defined('SERVICE_PATH')) { |
|
111 | 111 | /** |
112 | 112 | * Services directory path |
113 | 113 | */ |
114 | 114 | define('SERVICE_PATH', APP_PATH . 'services' . DS); |
115 | 115 | } |
116 | 116 | |
117 | -if (! defined('DATABASE_PATH')) { |
|
117 | +if (!defined('DATABASE_PATH')) { |
|
118 | 118 | /** |
119 | 119 | * Database storage directory path |
120 | 120 | */ |
121 | 121 | define('DATABASE_PATH', STORAGE_PATH . 'database' . DS); |
122 | 122 | } |
123 | 123 | |
124 | -if (! defined('DB_SEED_PATH')) { |
|
124 | +if (!defined('DB_SEED_PATH')) { |
|
125 | 125 | /** |
126 | 126 | * Database seeds storage path |
127 | 127 | */ |
128 | 128 | define('DB_SEED_PATH', APP_RESOURCE_PATH . 'database' . DS . 'seeds' . DS); |
129 | 129 | } |
130 | 130 | |
131 | -if (! defined('DB_DUMP_PATH')) { |
|
131 | +if (!defined('DB_DUMP_PATH')) { |
|
132 | 132 | /** |
133 | 133 | * Database backup storage path |
134 | 134 | */ |
135 | 135 | define('DB_DUMP_PATH', DATABASE_PATH . 'dump' . DS); |
136 | 136 | } |
137 | 137 | |
138 | -if (! defined('DB_CACHE_PATH')) { |
|
138 | +if (!defined('DB_CACHE_PATH')) { |
|
139 | 139 | /** |
140 | 140 | * Database cache directory path |
141 | 141 | */ |
@@ -157,11 +157,11 @@ discard block |
||
157 | 157 | */ |
158 | 158 | defined('SECOND') || define('SECOND', 1); |
159 | 159 | defined('MINUTE') || define('MINUTE', 60); |
160 | -defined('HOUR') || define('HOUR', 3600); |
|
161 | -defined('DAY') || define('DAY', 86400); |
|
162 | -defined('WEEK') || define('WEEK', 604800); |
|
163 | -defined('MONTH') || define('MONTH', 2592000); |
|
164 | -defined('YEAR') || define('YEAR', 31536000); |
|
160 | +defined('HOUR') || define('HOUR', 3600); |
|
161 | +defined('DAY') || define('DAY', 86400); |
|
162 | +defined('WEEK') || define('WEEK', 604800); |
|
163 | +defined('MONTH') || define('MONTH', 2592000); |
|
164 | +defined('YEAR') || define('YEAR', 31536000); |
|
165 | 165 | defined('DECADE') || define('DECADE', 315360000); |
166 | 166 | |
167 | 167 | /** |
@@ -182,13 +182,13 @@ discard block |
||
182 | 182 | * - BSD sysexits.h: http://www.gsp.com/cgi-bin/man.cgi?section=3&topic=sysexits |
183 | 183 | * - Bash scripting: http://tldp.org/LDP/abs/html/exitcodes.html |
184 | 184 | */ |
185 | -defined('EXIT_SUCCESS') || define('EXIT_SUCCESS', 0); // pas d'erreurs |
|
186 | -defined('EXIT_ERROR') || define('EXIT_ERROR', 1); // erreur generique |
|
187 | -defined('EXIT_CONFIG') || define('EXIT_CONFIG', 3); // erreur de configuration |
|
188 | -defined('EXIT_UNKNOWN_FILE') || define('EXIT_UNKNOWN_FILE', 4); // fichier non trouvé |
|
189 | -defined('EXIT_UNKNOWN_CLASS') || define('EXIT_UNKNOWN_CLASS', 5); // classe inconnue |
|
185 | +defined('EXIT_SUCCESS') || define('EXIT_SUCCESS', 0); // pas d'erreurs |
|
186 | +defined('EXIT_ERROR') || define('EXIT_ERROR', 1); // erreur generique |
|
187 | +defined('EXIT_CONFIG') || define('EXIT_CONFIG', 3); // erreur de configuration |
|
188 | +defined('EXIT_UNKNOWN_FILE') || define('EXIT_UNKNOWN_FILE', 4); // fichier non trouvé |
|
189 | +defined('EXIT_UNKNOWN_CLASS') || define('EXIT_UNKNOWN_CLASS', 5); // classe inconnue |
|
190 | 190 | defined('EXIT_UNKNOWN_METHOD') || define('EXIT_UNKNOWN_METHOD', 6); // membre de classe inconnu |
191 | -defined('EXIT_USER_INPUT') || define('EXIT_USER_INPUT', 7); // saisie utilisateur invalide |
|
192 | -defined('EXIT_DATABASE') || define('EXIT_DATABASE', 8); // erreur de base de données |
|
193 | -defined('EXIT__AUTO_MIN') || define('EXIT__AUTO_MIN', 9); // code d'erreur attribué automatiquement le plus bas |
|
194 | -defined('EXIT__AUTO_MAX') || define('EXIT__AUTO_MAX', 125); // code d'erreur attribué automatiquement le plus élevé |
|
191 | +defined('EXIT_USER_INPUT') || define('EXIT_USER_INPUT', 7); // saisie utilisateur invalide |
|
192 | +defined('EXIT_DATABASE') || define('EXIT_DATABASE', 8); // erreur de base de données |
|
193 | +defined('EXIT__AUTO_MIN') || define('EXIT__AUTO_MIN', 9); // code d'erreur attribué automatiquement le plus bas |
|
194 | +defined('EXIT__AUTO_MAX') || define('EXIT__AUTO_MAX', 125); // code d'erreur attribué automatiquement le plus élevé |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | |
14 | 14 | // Ce helper est automatiquement chargé par BlitzPHP. |
15 | 15 | |
16 | -if (! function_exists('dd')) { |
|
16 | +if (!function_exists('dd')) { |
|
17 | 17 | /** |
18 | 18 | * Imprime un rapport de débogage Kint et coupe le script. |
19 | 19 | * |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | } |
33 | 33 | } |
34 | 34 | |
35 | -if (! function_exists('dump')) { |
|
35 | +if (!function_exists('dump')) { |
|
36 | 36 | /** |
37 | 37 | * Imprime un rapport de débogage Kint sans couper le script. |
38 | 38 | * |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | } |
50 | 50 | } |
51 | 51 | |
52 | -if (! function_exists('d') && ! class_exists(Kint::class)) { |
|
52 | +if (!function_exists('d') && !class_exists(Kint::class)) { |
|
53 | 53 | // Au cas où Kint n'est pas chargé |
54 | 54 | /** |
55 | 55 | * @param array $vars |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | } |
61 | 61 | } |
62 | 62 | |
63 | -if (! function_exists('trace')) { |
|
63 | +if (!function_exists('trace')) { |
|
64 | 64 | /** |
65 | 65 | * Fournit un backtrace au point d'exécution actuel, à partir de Kint. |
66 | 66 | * |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | */ |
71 | 71 | function trace() |
72 | 72 | { |
73 | - if (! class_exists(Kint::class)) { |
|
73 | + if (!class_exists(Kint::class)) { |
|
74 | 74 | return 0; |
75 | 75 | } |
76 | 76 |
@@ -120,17 +120,17 @@ discard block |
||
120 | 120 | return static::$instances[Cache::class] = new Cache($config); |
121 | 121 | } |
122 | 122 | |
123 | - /** |
|
124 | - * La clase Config offre une api fluide por gerer les configurations de l'application |
|
125 | - */ |
|
126 | - public static function config(bool $shared = true): Config |
|
127 | - { |
|
128 | - if (true === $shared && isset(static::$instances[Config::class])) { |
|
123 | + /** |
|
124 | + * La clase Config offre une api fluide por gerer les configurations de l'application |
|
125 | + */ |
|
126 | + public static function config(bool $shared = true): Config |
|
127 | + { |
|
128 | + if (true === $shared && isset(static::$instances[Config::class])) { |
|
129 | 129 | return static::$instances[Config::class]; |
130 | 130 | } |
131 | 131 | |
132 | - return static::$instances[Config::class] = new Config(); |
|
133 | - } |
|
132 | + return static::$instances[Config::class] = new Config(); |
|
133 | + } |
|
134 | 134 | |
135 | 135 | /** |
136 | 136 | * Conteneur d'injection de dependances |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | return static::$instances[Container::class]; |
142 | 142 | } |
143 | 143 | |
144 | - return static::$instances[Container::class] = new Container(); |
|
144 | + return static::$instances[Container::class] = new Container(); |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | /** |
@@ -504,7 +504,7 @@ discard block |
||
504 | 504 | |
505 | 505 | protected static function cacheServices(): void |
506 | 506 | { |
507 | - if (! static::$discovered) { |
|
507 | + if (!static::$discovered) { |
|
508 | 508 | $locator = static::locator(); |
509 | 509 | $files = $locator->search('Config/Services'); |
510 | 510 | |
@@ -531,7 +531,7 @@ discard block |
||
531 | 531 | $name = array_shift($arguments); |
532 | 532 | |
533 | 533 | if (empty(static::$instances[$name])) { |
534 | - if (! empty($arguments)) { |
|
534 | + if (!empty($arguments)) { |
|
535 | 535 | static::$instances[$name] = static::factory($name, $arguments); |
536 | 536 | } else { |
537 | 537 | static::$instances[$name] = static::container()->get($name); |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | */ |
129 | 129 | public static function providers(): array |
130 | 130 | { |
131 | - if (! empty(static::$providers)) { |
|
131 | + if (!empty(static::$providers)) { |
|
132 | 132 | return static::$providers; |
133 | 133 | } |
134 | 134 | |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | } |
158 | 158 | |
159 | 159 | // Les providers par défaut du système doivent être ajouté en premier pour que les autres puisse les surcharger |
160 | - if (! empty($systemProvider)) { |
|
160 | + if (!empty($systemProvider)) { |
|
161 | 161 | $providers[] = $systemProvider; |
162 | 162 | } |
163 | 163 | |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | $providers = [...$providers, ...$localIncludes]; |
166 | 166 | |
167 | 167 | // Enfin ceux de l'application doivent remplacer tous les autres |
168 | - if (! empty($appProvider)) { |
|
168 | + if (!empty($appProvider)) { |
|
169 | 169 | $providers[] = $appProvider; |
170 | 170 | } |
171 | 171 |
@@ -125,8 +125,8 @@ discard block |
||
125 | 125 | * Chemin de requête à utiliser. |
126 | 126 | * |
127 | 127 | * @var string |
128 | - * |
|
129 | - * @deprecated No longer used. |
|
128 | + * |
|
129 | + * @deprecated No longer used. |
|
130 | 130 | */ |
131 | 131 | protected $path; |
132 | 132 | |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | */ |
136 | 136 | protected int $bufferLevel = 0; |
137 | 137 | |
138 | - /** |
|
138 | + /** |
|
139 | 139 | * Mise en cache des pages Web |
140 | 140 | */ |
141 | 141 | protected ResponseCache $pageCache; |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | $this->startTime = microtime(true); |
149 | 149 | $this->config = (object) config('app'); |
150 | 150 | |
151 | - $this->pageCache = Services::responsecache(); |
|
151 | + $this->pageCache = Services::responsecache(); |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | /** |
@@ -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 | |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | |
211 | 211 | $this->initMiddlewareQueue(); |
212 | 212 | |
213 | - try { |
|
213 | + try { |
|
214 | 214 | $this->response = $this->handleRequest($routes, config('cache')); |
215 | 215 | } catch (ResponsableInterface|RedirectException $e) { |
216 | 216 | $this->outputBufferingEnd(); |
@@ -242,17 +242,17 @@ discard block |
||
242 | 242 | */ |
243 | 243 | protected function handleRequest(?RouteCollectionInterface $routes = null, ?array $cacheConfig = null): ResponseInterface |
244 | 244 | { |
245 | - $this->forceSecureAccess(); |
|
245 | + $this->forceSecureAccess(); |
|
246 | 246 | |
247 | - /** |
|
247 | + /** |
|
248 | 248 | * Init event manager |
249 | 249 | */ |
250 | - Services::singleton(EventDiscover::class)->discove(); |
|
250 | + Services::singleton(EventDiscover::class)->discove(); |
|
251 | 251 | |
252 | - $this->event->trigger('pre_system'); |
|
252 | + $this->event->trigger('pre_system'); |
|
253 | 253 | |
254 | - // Check for a cached page. |
|
255 | - // Execution will stop if the page has been cached. |
|
254 | + // Check for a cached page. |
|
255 | + // Execution will stop if the page has been cached. |
|
256 | 256 | if (($response = $this->displayCache($cacheConfig)) instanceof ResponseInterface) { |
257 | 257 | return $response; |
258 | 258 | } |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | $routeMiddlewares = (array) $this->dispatchRoutes($routes); |
261 | 261 | |
262 | 262 | // Le bootstrap dans un middleware |
263 | - $this->middleware->alias('blitz', $this->bootApp()); |
|
263 | + $this->middleware->alias('blitz', $this->bootApp()); |
|
264 | 264 | $this->middleware->append('blitz'); |
265 | 265 | |
266 | 266 | /** |
@@ -383,13 +383,13 @@ discard block |
||
383 | 383 | */ |
384 | 384 | public function displayCache(?array $config = null) |
385 | 385 | { |
386 | - if ($cachedResponse = $this->pageCache->get($this->request, $this->response)) { |
|
386 | + if ($cachedResponse = $this->pageCache->get($this->request, $this->response)) { |
|
387 | 387 | $this->response = $cachedResponse; |
388 | 388 | |
389 | 389 | $this->totalTime = $this->timer->getElapsedTime('total_execution'); |
390 | 390 | $output = $this->displayPerformanceMetrics($cachedResponse->getBody()); |
391 | 391 | |
392 | - return $this->response->withBody(to_stream($output)); |
|
392 | + return $this->response->withBody(to_stream($output)); |
|
393 | 393 | } |
394 | 394 | |
395 | 395 | return false; |
@@ -588,7 +588,7 @@ discard block |
||
588 | 588 | |
589 | 589 | $this->gatherOutput($returned); |
590 | 590 | |
591 | - return $this->response; |
|
591 | + return $this->response; |
|
592 | 592 | } |
593 | 593 | |
594 | 594 | // Affiche l'erreur 404 |
@@ -658,13 +658,13 @@ discard block |
||
658 | 658 | $uri = Services::uri($uri, false); |
659 | 659 | } |
660 | 660 | |
661 | - Services::session()->setPreviousUrl(Uri::createURIString( |
|
662 | - $uri->getScheme(), |
|
663 | - $uri->getAuthority(), |
|
664 | - $uri->getPath(), |
|
665 | - $uri->getQuery(), |
|
666 | - $uri->getFragment() |
|
667 | - )); |
|
661 | + Services::session()->setPreviousUrl(Uri::createURIString( |
|
662 | + $uri->getScheme(), |
|
663 | + $uri->getAuthority(), |
|
664 | + $uri->getPath(), |
|
665 | + $uri->getQuery(), |
|
666 | + $uri->getFragment() |
|
667 | + )); |
|
668 | 668 | } |
669 | 669 | |
670 | 670 | /** |
@@ -696,9 +696,9 @@ discard block |
||
696 | 696 | return $returned; |
697 | 697 | } |
698 | 698 | |
699 | - if ($returned instanceof Responsable) { |
|
700 | - return $returned->toResponse($this->request); |
|
701 | - } |
|
699 | + if ($returned instanceof Responsable) { |
|
700 | + return $returned->toResponse($this->request); |
|
701 | + } |
|
702 | 702 | |
703 | 703 | if (is_object($returned)) { |
704 | 704 | if (method_exists($returned, '__toString')) { |
@@ -743,11 +743,11 @@ discard block |
||
743 | 743 | $this->middleware->prepend($this->spoofRequestMethod()); |
744 | 744 | } |
745 | 745 | |
746 | - protected function outputBufferingStart(): void |
|
746 | + protected function outputBufferingStart(): void |
|
747 | 747 | { |
748 | 748 | $this->bufferLevel = ob_get_level(); |
749 | 749 | |
750 | - ob_start(); |
|
750 | + ob_start(); |
|
751 | 751 | } |
752 | 752 | |
753 | 753 | protected function outputBufferingEnd(): string |
@@ -817,7 +817,7 @@ discard block |
||
817 | 817 | } |
818 | 818 | |
819 | 819 | if (is_string($this->controller)) { |
820 | - if (strtoupper($request->getMethod()) === 'POST') { |
|
820 | + if (strtoupper($request->getMethod()) === 'POST') { |
|
821 | 821 | if (is_subclass_of($this->controller, RestController::class)) { |
822 | 822 | return $this->formatResponse($response->withStatus($code), [ |
823 | 823 | 'success' => false, |
@@ -825,7 +825,7 @@ discard block |
||
825 | 825 | 'errors' => $errors, |
826 | 826 | ]); |
827 | 827 | } |
828 | - if (is_subclass_of($this->controller, BaseController::class)) { |
|
828 | + if (is_subclass_of($this->controller, BaseController::class)) { |
|
829 | 829 | return Services::redirection()->back()->withInput()->withErrors($errors)->withStatus($code); |
830 | 830 | } |
831 | 831 | } |
@@ -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 | |
@@ -733,7 +733,7 @@ discard block |
||
733 | 733 | $this->middleware = new Middleware($this->response, $this->determinePath()); |
734 | 734 | |
735 | 735 | $middlewaresFile = CONFIG_PATH . 'middlewares.php'; |
736 | - if (file_exists($middlewaresFile) && ! in_array($middlewaresFile, get_included_files(), true)) { |
|
736 | + if (file_exists($middlewaresFile) && !in_array($middlewaresFile, get_included_files(), true)) { |
|
737 | 737 | $middleware = require $middlewaresFile; |
738 | 738 | if (is_callable($middleware)) { |
739 | 739 | $middleware($this->middleware, $this->request); |
@@ -768,11 +768,11 @@ discard block |
||
768 | 768 | */ |
769 | 769 | private function spoofRequestMethod(): callable |
770 | 770 | { |
771 | - return static function (ServerRequestInterface $request, ResponseInterface $response, callable $next) { |
|
771 | + return static function(ServerRequestInterface $request, ResponseInterface $response, callable $next) { |
|
772 | 772 | $post = $request->getParsedBody(); |
773 | 773 | |
774 | 774 | // Ne fonctionne qu'avec les formulaires POST |
775 | - if (strtoupper($request->getMethod()) === 'POST' && ! empty($post['_method'])) { |
|
775 | + if (strtoupper($request->getMethod()) === 'POST' && !empty($post['_method'])) { |
|
776 | 776 | // Accepte seulement PUT, PATCH, DELETE |
777 | 777 | if (in_array(strtoupper($post['_method']), ['PUT', 'PATCH', 'DELETE'], true)) { |
778 | 778 | $request = $request->withMethod($post['_method']); |
@@ -785,15 +785,15 @@ discard block |
||
785 | 785 | |
786 | 786 | private function bootApp(): callable |
787 | 787 | { |
788 | - return function (ServerRequestInterface $request, ResponseInterface $response, callable $next): ResponseInterface { |
|
788 | + return function(ServerRequestInterface $request, ResponseInterface $response, callable $next): ResponseInterface { |
|
789 | 789 | try { |
790 | 790 | $returned = $this->startController($request, $response); |
791 | 791 | |
792 | 792 | // Closure controller has run in startController(). |
793 | - if (! is_callable($this->controller)) { |
|
793 | + if (!is_callable($this->controller)) { |
|
794 | 794 | $controller = $this->createController($request, $response); |
795 | 795 | |
796 | - if (! method_exists($controller, '_remap') && ! is_callable([$controller, $this->method], false)) { |
|
796 | + if (!method_exists($controller, '_remap') && !is_callable([$controller, $this->method], false)) { |
|
797 | 797 | throw PageNotFoundException::methodNotFound($this->method); |
798 | 798 | } |
799 | 799 |
@@ -31,7 +31,7 @@ |
||
31 | 31 | $column = $this->parameter('column'); |
32 | 32 | $column = $column ?: $this->getAttribute()->getKey(); |
33 | 33 | |
34 | - $builder = $this->db->table($table)->where($column, $value); |
|
34 | + $builder = $this->db->table($table)->where($column, $value); |
|
35 | 35 | |
36 | 36 | return $builder->count() > 0; |
37 | 37 | } |