@@ -23,7 +23,7 @@ |
||
23 | 23 | |
24 | 24 | public function __construct(?Router $router = null) |
25 | 25 | { |
26 | - $this->router = $router ?? Services::router(); |
|
26 | + $this->router = $router ?? Services::router(); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | /** |
@@ -26,7 +26,7 @@ |
||
26 | 26 | */ |
27 | 27 | public function __construct(private string $namespace) |
28 | 28 | { |
29 | - $this->locator = Services::locator(); |
|
29 | + $this->locator = Services::locator(); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | /** |
@@ -133,11 +133,11 @@ |
||
133 | 133 | $table = []; |
134 | 134 | foreach ($tbody as $route) { |
135 | 135 | $table[] = [ |
136 | - 'Methode' => $route[0], |
|
137 | - 'Route' => $route[1], |
|
138 | - 'Nom' => $route[2], |
|
136 | + 'Methode' => $route[0], |
|
137 | + 'Route' => $route[1], |
|
138 | + 'Nom' => $route[2], |
|
139 | 139 | $sortByHandler ? 'Gestionnaire ↓' : 'Gestionnaire' => $route[3], |
140 | - 'Middlewares' => $route[4], |
|
140 | + 'Middlewares' => $route[4], |
|
141 | 141 | ]; |
142 | 142 | } |
143 | 143 |
@@ -53,15 +53,15 @@ |
||
53 | 53 | |
54 | 54 | $viewer->setData($data)->setOptions($options); |
55 | 55 | |
56 | - if (! empty($this->layout) && is_string($this->layout)) { |
|
56 | + if (!empty($this->layout) && is_string($this->layout)) { |
|
57 | 57 | $viewer->setLayout($this->layout); |
58 | 58 | } |
59 | 59 | |
60 | - if (! empty($this->viewDatas) && is_array($this->viewDatas)) { |
|
60 | + if (!empty($this->viewDatas) && is_array($this->viewDatas)) { |
|
61 | 61 | $viewer->addData($this->viewDatas); |
62 | 62 | } |
63 | 63 | |
64 | - if (! is_string($controllerName = Dispatcher::getController(false))) { |
|
64 | + if (!is_string($controllerName = Dispatcher::getController(false))) { |
|
65 | 65 | $controllerName = static::class; |
66 | 66 | } |
67 | 67 |
@@ -22,8 +22,8 @@ |
||
22 | 22 | * @method static RouteBuilder setDefaultMethod(string $value) Définit la méthode par défaut pour appeler le contrôleur lorsqu'aucun autre méthode a été définie dans la route. |
23 | 23 | * @method static RouteBuilder setTranslateURIDashes(bool $value) Indique au système s'il faut convertir les tirets des chaînes URI en traits de soulignement. |
24 | 24 | * @method static RouteBuilder setAutoRoute(bool $value) Si TRUE, le système tentera de faire correspondre l'URI avec |
25 | - * Contrôleurs en faisant correspondre chaque segment avec des dossiers/fichiers |
|
26 | - * dans CONTROLLER_PATH, lorsqu'aucune correspondance n'a été trouvée pour les routes définies. |
|
25 | + * Contrôleurs en faisant correspondre chaque segment avec des dossiers/fichiers |
|
26 | + * dans CONTROLLER_PATH, lorsqu'aucune correspondance n'a été trouvée pour les routes définies. |
|
27 | 27 | * @method static RouteBuilder set404Override($callable = null) Définit la classe/méthode qui doit être appelée si le routage ne trouver pas une correspondance. |
28 | 28 | * @method static RouteBuilder setDefaultConstraint(string $placeholder) Définit la contrainte par défaut à utiliser dans le système. Typiquement à utiliser avec la méthode 'ressource'. |
29 | 29 | * @method static RouteBuilder setPrioritize(bool $enabled = true) Activer ou désactiver le tri des routes par priorité |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | return $models; |
74 | 74 | } |
75 | 75 | |
76 | - if (! self::isLoaded('models', $model)) { |
|
76 | + if (!self::isLoaded('models', $model)) { |
|
77 | 77 | self::loaded('models', $model, FileLocator::model($model, $connection)); |
78 | 78 | } |
79 | 79 | |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | */ |
88 | 88 | private static function isLoaded(string $module, $element): bool |
89 | 89 | { |
90 | - if (! isset(self::$loads[$module]) || ! is_array(self::$loads[$module])) { |
|
90 | + if (!isset(self::$loads[$module]) || !is_array(self::$loads[$module])) { |
|
91 | 91 | return false; |
92 | 92 | } |
93 | 93 |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | |
38 | 38 | $loader = Services::locator(); |
39 | 39 | |
40 | - if (! is_array($filenames)) { |
|
40 | + if (!is_array($filenames)) { |
|
41 | 41 | $filenames = [$filenames]; |
42 | 42 | } |
43 | 43 | |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | } |
82 | 82 | |
83 | 83 | // Les helpers au niveau de l'application doivent remplacer tous les autres |
84 | - if (! empty($appHelper)) { |
|
84 | + if (!empty($appHelper)) { |
|
85 | 85 | $includes[] = $appHelper; |
86 | 86 | $loaded[] = $filename; |
87 | 87 | } |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | $includes = [...$includes, ...$localIncludes]; |
91 | 91 | |
92 | 92 | // Et celui par défaut du système doit être ajouté en dernier. |
93 | - if (! empty($systemHelper)) { |
|
93 | + if (!empty($systemHelper)) { |
|
94 | 94 | $includes[] = $systemHelper; |
95 | 95 | $loaded[] = $filename; |
96 | 96 | } |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | throw LoadException::libraryNotFound($lib); |
137 | 137 | } |
138 | 138 | |
139 | - if (true !== $file_syst && ! class_exists($lib)) { |
|
139 | + if (true !== $file_syst && !class_exists($lib)) { |
|
140 | 140 | throw LoadException::libraryDontExist($lib); |
141 | 141 | } |
142 | 142 | |
@@ -154,16 +154,16 @@ discard block |
||
154 | 154 | */ |
155 | 155 | public static function model(string $model, ?ConnectionInterface $connection = null) |
156 | 156 | { |
157 | - if (! class_exists($model) && ! Text::endsWith($model, 'Model')) { |
|
157 | + if (!class_exists($model) && !Text::endsWith($model, 'Model')) { |
|
158 | 158 | $model .= 'Model'; |
159 | 159 | } |
160 | 160 | |
161 | - if (! class_exists($model)) { |
|
161 | + if (!class_exists($model)) { |
|
162 | 162 | $model = str_replace(APP_NAMESPACE . '\\Models\\', '', $model); |
163 | 163 | $model = APP_NAMESPACE . '\\Models\\' . $model; |
164 | 164 | } |
165 | 165 | |
166 | - if (! class_exists($model)) { |
|
166 | + if (!class_exists($model)) { |
|
167 | 167 | throw LoadException::modelNotFound($model); |
168 | 168 | } |
169 | 169 | |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | $controller = explode('/', $controller); |
182 | 182 | |
183 | 183 | $con = ucfirst(end($controller)); |
184 | - $con = (! preg_match('#Controller$#', $con)) ? $con . 'Controller' : $con; |
|
184 | + $con = (!preg_match('#Controller$#', $con)) ? $con . 'Controller' : $con; |
|
185 | 185 | $controller[count($controller) - 1] = $con; |
186 | 186 | |
187 | 187 | foreach ($controller as $key => &$value) { |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | |
193 | 193 | $path = CONTROLLER_PATH . Helpers::ensureExt(implode(DS, $controller), 'php'); |
194 | 194 | |
195 | - if (! file_exists($path)) { |
|
195 | + if (!file_exists($path)) { |
|
196 | 196 | throw LoadException::controllerNotFound(str_replace('Controller', '', $con), $path); |
197 | 197 | } |
198 | 198 | |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | if (class_exists($class_namespaced, false)) { |
204 | 204 | return Injector::make($class_namespaced); |
205 | 205 | } |
206 | - if (! class_exists($con, false)) { |
|
206 | + if (!class_exists($con, false)) { |
|
207 | 207 | throw LoadException::controllerDontExist(str_replace('Controller', '', $con), $path); |
208 | 208 | } |
209 | 209 | |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | protected static function verifyPreferApp(array $options, string $name): bool |
233 | 233 | { |
234 | 234 | // Tout element sans restriction passe |
235 | - if (! $options['preferApp']) { |
|
235 | + if (!$options['preferApp']) { |
|
236 | 236 | return true; |
237 | 237 | } |
238 | 238 |
@@ -36,13 +36,13 @@ discard block |
||
36 | 36 | */ |
37 | 37 | public static function init() |
38 | 38 | { |
39 | - if (! class_exists('Whoops\Run')) { |
|
39 | + if (!class_exists('Whoops\Run')) { |
|
40 | 40 | return; |
41 | 41 | } |
42 | 42 | |
43 | 43 | $whoops = new Run(); |
44 | 44 | |
45 | - if (! is_online()) { |
|
45 | + if (!is_online()) { |
|
46 | 46 | if (Misc::isCommandLine()) { |
47 | 47 | $whoops->pushHandler(new PlainTextHandler()); |
48 | 48 | } elseif (Misc::isAjaxRequest()) { |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | /** |
56 | 56 | * On log toutes les erreurs |
57 | 57 | */ |
58 | - $whoops->pushHandler(static function (Throwable $exception, Inspector $inspector, RunInterface $run) { |
|
58 | + $whoops->pushHandler(static function(Throwable $exception, Inspector $inspector, RunInterface $run) { |
|
59 | 59 | Services::logger()->error($exception); |
60 | 60 | |
61 | 61 | return Handler::DONE; |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | |
25 | 25 | // ================================= ================================= // |
26 | 26 | |
27 | -if (! function_exists('site_url')) { |
|
27 | +if (!function_exists('site_url')) { |
|
28 | 28 | /** |
29 | 29 | * Renvoie une URL de site telle que définie par la configuration de l'application. |
30 | 30 | * |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | } |
49 | 49 | } |
50 | 50 | |
51 | -if (! function_exists('base_url')) { |
|
51 | +if (!function_exists('base_url')) { |
|
52 | 52 | /** |
53 | 53 | * Renvoie l'URL de base telle que définie par la configuration de l'application. |
54 | 54 | * Les URL de base sont des URL de site coupées sans la page d'index. |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | } |
68 | 68 | } |
69 | 69 | |
70 | -if (! function_exists('current_url')) { |
|
70 | +if (!function_exists('current_url')) { |
|
71 | 71 | /** |
72 | 72 | * Renvoie l'URL complète (y compris les segments) de la page où cette fonction est placée |
73 | 73 | * |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | } |
95 | 95 | } |
96 | 96 | |
97 | -if (! function_exists('previous_url')) { |
|
97 | +if (!function_exists('previous_url')) { |
|
98 | 98 | /** |
99 | 99 | * Renvoie l'URL précédente sur laquelle se trouvait le visiteur actuel. Pour des raisons de sécurité |
100 | 100 | * nous vérifions d'abord une variable de session enregistrée, si elle existe, et l'utilisons. |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | } |
120 | 120 | } |
121 | 121 | |
122 | -if (! function_exists('uri_string')) { |
|
122 | +if (!function_exists('uri_string')) { |
|
123 | 123 | /** |
124 | 124 | * Renvoie la partie chemin de l'URL actuelle |
125 | 125 | * |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | } |
134 | 134 | } |
135 | 135 | |
136 | -if (! function_exists('index_page')) { |
|
136 | +if (!function_exists('index_page')) { |
|
137 | 137 | /** |
138 | 138 | * Renvoie la "index_page" de votre fichier de configuration |
139 | 139 | */ |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | } |
144 | 144 | } |
145 | 145 | |
146 | -if (! function_exists('anchor')) { |
|
146 | +if (!function_exists('anchor')) { |
|
147 | 147 | /** |
148 | 148 | * Crée une ancre basée sur l'URL locale. |
149 | 149 | * |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | } |
169 | 169 | } |
170 | 170 | |
171 | -if (! function_exists('anchor_popup')) { |
|
171 | +if (!function_exists('anchor_popup')) { |
|
172 | 172 | /** |
173 | 173 | * Lien d'ancrage - Version contextuelle |
174 | 174 | * |
@@ -191,12 +191,12 @@ discard block |
||
191 | 191 | return '<a href="' . $siteUrl . '" onclick="window.open(\'' . $siteUrl . "', '_blank'); return false;\">" . $title . '</a>'; |
192 | 192 | } |
193 | 193 | |
194 | - if (! is_array($attributes)) { |
|
194 | + if (!is_array($attributes)) { |
|
195 | 195 | $attributes = [$attributes]; |
196 | 196 | |
197 | 197 | // Ref: http://www.w3schools.com/jsref/met_win_open.asp |
198 | 198 | $windowName = '_blank'; |
199 | - } elseif (! empty($attributes['window_name'])) { |
|
199 | + } elseif (!empty($attributes['window_name'])) { |
|
200 | 200 | $windowName = $attributes['window_name']; |
201 | 201 | unset($attributes['window_name']); |
202 | 202 | } else { |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | } |
217 | 217 | } |
218 | 218 | |
219 | -if (! function_exists('mailto')) { |
|
219 | +if (!function_exists('mailto')) { |
|
220 | 220 | /** |
221 | 221 | * Lien Mailto |
222 | 222 | * |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | } |
234 | 234 | } |
235 | 235 | |
236 | -if (! function_exists('safe_mailto')) { |
|
236 | +if (!function_exists('safe_mailto')) { |
|
237 | 237 | /** |
238 | 238 | * Lien Mailto codé |
239 | 239 | * |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | } |
323 | 323 | } |
324 | 324 | |
325 | -if (! function_exists('auto_link')) { |
|
325 | +if (!function_exists('auto_link')) { |
|
326 | 326 | /** |
327 | 327 | * Lien automatique |
328 | 328 | * |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | function auto_link(string $str, string $type = 'both', bool $popup = false): string |
338 | 338 | { |
339 | 339 | // Recherche et remplace tous les URLs. |
340 | - if ($type !== 'email' && preg_match_all('#(\w*://|www\.)[^\s()<>;]+\w#i', $str, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER)) { |
|
340 | + if ($type !== 'email' && preg_match_all('#(\w*://|www\.)[^\s()<>;]+\w#i', $str, $matches, PREG_OFFSET_CAPTURE|PREG_SET_ORDER)) { |
|
341 | 341 | // Définissez notre HTML cible si vous utilisez des liens contextuels. |
342 | 342 | $target = ($popup) ? ' target="_blank"' : ''; |
343 | 343 | |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | } |
369 | 369 | } |
370 | 370 | |
371 | -if (! function_exists('prep_url')) { |
|
371 | +if (!function_exists('prep_url')) { |
|
372 | 372 | /** |
373 | 373 | * Ajoute simplement la partie http:// ou https:// si aucun schéma n'est inclus. |
374 | 374 | * |
@@ -393,7 +393,7 @@ discard block |
||
393 | 393 | } |
394 | 394 | } |
395 | 395 | |
396 | -if (! function_exists('url_title')) { |
|
396 | +if (!function_exists('url_title')) { |
|
397 | 397 | /** |
398 | 398 | * Créer un titre d'URL |
399 | 399 | * |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | } |
430 | 430 | } |
431 | 431 | |
432 | -if (! function_exists('mb_url_title')) { |
|
432 | +if (!function_exists('mb_url_title')) { |
|
433 | 433 | /** |
434 | 434 | * Créer un titre d'URL qui prend en compte les caractères accentués |
435 | 435 | * |
@@ -448,7 +448,7 @@ discard block |
||
448 | 448 | } |
449 | 449 | } |
450 | 450 | |
451 | -if (! function_exists('url_to')) { |
|
451 | +if (!function_exists('url_to')) { |
|
452 | 452 | /** |
453 | 453 | * Obtenir l'URL complète et absolue d'une méthode de contrôleur |
454 | 454 | * (avec arguments supplémentaires) |
@@ -461,7 +461,7 @@ discard block |
||
461 | 461 | */ |
462 | 462 | function url_to(string $controller, ...$args): string |
463 | 463 | { |
464 | - if (! $route = link_to($controller, ...$args)) { |
|
464 | + if (!$route = link_to($controller, ...$args)) { |
|
465 | 465 | $explode = explode('::', $controller); |
466 | 466 | |
467 | 467 | if (isset($explode[1])) { |
@@ -475,7 +475,7 @@ discard block |
||
475 | 475 | } |
476 | 476 | } |
477 | 477 | |
478 | -if (! function_exists('url_is')) { |
|
478 | +if (!function_exists('url_is')) { |
|
479 | 479 | /** |
480 | 480 | * Détermine si le chemin d'URL actuel contient le chemin donné. |
481 | 481 | * Il peut contenir un caractère générique (*) qui autorisera tout caractère valide. |
@@ -493,7 +493,7 @@ discard block |
||
493 | 493 | } |
494 | 494 | } |
495 | 495 | |
496 | -if (! function_exists('link_active')) { |
|
496 | +if (!function_exists('link_active')) { |
|
497 | 497 | /** |
498 | 498 | * Lien actif dans la navbar |
499 | 499 | * Un peut comme le router-active-link de vuejs |
@@ -508,7 +508,7 @@ discard block |
||
508 | 508 | return $active_class; |
509 | 509 | } |
510 | 510 | |
511 | - if (! $exact && preg_match('#^' . $path . '/?#i', $current_section)) { |
|
511 | + if (!$exact && preg_match('#^' . $path . '/?#i', $current_section)) { |
|
512 | 512 | return $active_class; |
513 | 513 | } |
514 | 514 | |
@@ -520,14 +520,14 @@ discard block |
||
520 | 520 | } |
521 | 521 | } |
522 | 522 | |
523 | -if (! function_exists('clean_url')) { |
|
523 | +if (!function_exists('clean_url')) { |
|
524 | 524 | function clean_url(string $url): string |
525 | 525 | { |
526 | 526 | return Helpers::cleanUrl($url); |
527 | 527 | } |
528 | 528 | } |
529 | 529 | |
530 | -if (! function_exists('is_absolute_link')) { |
|
530 | +if (!function_exists('is_absolute_link')) { |
|
531 | 531 | /** |
532 | 532 | * Verifies si un chemin donnée est une url absolue ou relative |
533 | 533 | */ |