@@ -108,11 +108,11 @@ discard block |
||
108 | 108 | $this->modelName = is_object($which) ? null : $which; |
109 | 109 | } |
110 | 110 | |
111 | - if (empty($this->model) && ! empty($this->modelName) && class_exists($this->modelName)) { |
|
111 | + if (empty($this->model) && !empty($this->modelName) && class_exists($this->modelName)) { |
|
112 | 112 | // $this->model = model($this->modelName); |
113 | 113 | } |
114 | 114 | |
115 | - if (! empty($this->model) && empty($this->modelName)) { |
|
115 | + if (!empty($this->model) && empty($this->modelName)) { |
|
116 | 116 | $this->modelName = get_class($this->model); |
117 | 117 | } |
118 | 118 | } |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | */ |
151 | 151 | private function getModel() |
152 | 152 | { |
153 | - if (! empty($this->modelName)) { |
|
153 | + if (!empty($this->modelName)) { |
|
154 | 154 | $this->setModel($this->modelName); |
155 | 155 | |
156 | 156 | return; |
@@ -61,8 +61,8 @@ discard block |
||
61 | 61 | $this->config = (object) config('rest'); |
62 | 62 | |
63 | 63 | $locale = $this->config->language ?? null; |
64 | - $locale = ! empty($locale) ? $locale : config('app.language'); |
|
65 | - $this->locale = ! empty($locale) ? $locale : 'en'; |
|
64 | + $locale = !empty($locale) ? $locale : config('app.language'); |
|
65 | + $this->locale = !empty($locale) ? $locale : 'en'; |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | /** |
@@ -97,18 +97,18 @@ discard block |
||
97 | 97 | final protected function respondFail(?string $message = "Une erreur s'est produite", int $status = StatusCode::INTERNAL_ERROR, int|string|null $code = null, array $errors = []): Response |
98 | 98 | { |
99 | 99 | $message = $message ?: "Une erreur s'est produite"; |
100 | - $code = ! empty($code) ? $code : $status; |
|
100 | + $code = !empty($code) ? $code : $status; |
|
101 | 101 | |
102 | 102 | $response = [ |
103 | 103 | $this->config->field['message'] ?? 'message' => $message, |
104 | 104 | ]; |
105 | - if (! empty($this->config->field['status'])) { |
|
105 | + if (!empty($this->config->field['status'])) { |
|
106 | 106 | $response[$this->config->field['status']] = false; |
107 | 107 | } |
108 | - if (! empty($this->config->field['code'])) { |
|
108 | + if (!empty($this->config->field['code'])) { |
|
109 | 109 | $response[$this->config->field['code']] = $code; |
110 | 110 | } |
111 | - if (! empty($errors)) { |
|
111 | + if (!empty($errors)) { |
|
112 | 112 | $response[$this->config->field['errors'] ?? 'errors'] = $errors; |
113 | 113 | } |
114 | 114 | |
@@ -127,12 +127,12 @@ discard block |
||
127 | 127 | final protected function respondSuccess(?string $message = 'Resultat', $result = null, ?int $status = StatusCode::OK): Response |
128 | 128 | { |
129 | 129 | $message = $message ?: 'Resultat'; |
130 | - $status = ! empty($status) ? $status : StatusCode::OK; |
|
130 | + $status = !empty($status) ? $status : StatusCode::OK; |
|
131 | 131 | |
132 | 132 | $response = [ |
133 | 133 | $this->config->field['message'] ?? 'message' => $message, |
134 | 134 | ]; |
135 | - if (! empty($this->config->field['status'])) { |
|
135 | + if (!empty($this->config->field['status'])) { |
|
136 | 136 | $response[$this->config->field['status']] = true; |
137 | 137 | } |
138 | 138 | if (is_array($result)) { |
@@ -181,13 +181,13 @@ discard block |
||
181 | 181 | } |
182 | 182 | |
183 | 183 | // Si la méthode de format existe, appelle et renvoie la sortie dans ce format |
184 | - if (! empty($mime)) { |
|
184 | + if (!empty($mime)) { |
|
185 | 185 | $output = Formatter::type($mime)->format($data); |
186 | 186 | |
187 | 187 | // Définit l'en-tête du format |
188 | 188 | // Ensuite, vérifiez si le client a demandé un rappel, et si la sortie contient ce rappel : |
189 | 189 | $callback = $this->request->getQuery('callback'); |
190 | - if (! empty($callback) && $mime === $this->mimes['json'] && preg_match('/^' . $callback . '/', $output)) { |
|
190 | + if (!empty($callback) && $mime === $this->mimes['json'] && preg_match('/^' . $callback . '/', $output)) { |
|
191 | 191 | $this->response = $this->response->withType($this->mimes['jsonp']); |
192 | 192 | } else { |
193 | 193 | $this->response = $this->response->withType($mime === $this->mimes['array'] ? $this->mimes['json'] : $mime); |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | |
21 | 21 | // ================================= FONCTIONS D'ACCESSIBILITE ================================= // |
22 | 22 | |
23 | -if (! function_exists('env')) { |
|
23 | +if (!function_exists('env')) { |
|
24 | 24 | |
25 | 25 | /** |
26 | 26 | * Obtient une variable d'environnement à partir des sources disponibles et fournit une émulation |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | } |
38 | 38 | } |
39 | 39 | |
40 | -if (! function_exists('helper')) { |
|
40 | +if (!function_exists('helper')) { |
|
41 | 41 | /** |
42 | 42 | * Charge un fichier d'aide en mémoire. Prend en charge les assistants d'espace de noms, |
43 | 43 | * à la fois dans et hors du répertoire 'helpers' d'un répertoire à espace de noms. |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | } |
56 | 56 | } |
57 | 57 | |
58 | -if (! function_exists('service')) { |
|
58 | +if (!function_exists('service')) { |
|
59 | 59 | /** |
60 | 60 | * Permet un accès plus propre au fichier de configuration des services. |
61 | 61 | * Renvoie toujours une instance SHARED de la classe, donc |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | } |
73 | 73 | } |
74 | 74 | |
75 | -if (! function_exists('single_service')) { |
|
75 | +if (!function_exists('single_service')) { |
|
76 | 76 | /** |
77 | 77 | * Autoriser l'accès propre à un service. |
78 | 78 | * Renvoie toujours une nouvelle instance de la classe. |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | } |
87 | 87 | } |
88 | 88 | |
89 | -if (! function_exists('show404')) { |
|
89 | +if (!function_exists('show404')) { |
|
90 | 90 | /** |
91 | 91 | * Afficher une page 404 introuvable dans le navigateur |
92 | 92 | */ |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | } |
97 | 97 | } |
98 | 98 | |
99 | -if (! function_exists('config')) { |
|
99 | +if (!function_exists('config')) { |
|
100 | 100 | /** |
101 | 101 | * GET/SET App config |
102 | 102 | * |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | */ |
107 | 107 | function config(string $config, $value = null, bool $force_set = false) |
108 | 108 | { |
109 | - if (! empty($value) || (empty($value) && true === $force_set)) { |
|
109 | + if (!empty($value) || (empty($value) && true === $force_set)) { |
|
110 | 110 | Config::set($config, $value); |
111 | 111 | } |
112 | 112 | |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | |
117 | 117 | // ================================= FONCTIONS D'ENVIRONNEMENT D'EXECUTION ================================= // |
118 | 118 | |
119 | -if (! function_exists('on_dev')) { |
|
119 | +if (!function_exists('on_dev')) { |
|
120 | 120 | /** |
121 | 121 | * Testez pour voir si nous sommes dans un environnement de développement. |
122 | 122 | */ |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | } |
133 | 133 | } |
134 | 134 | |
135 | -if (! function_exists('on_prod')) { |
|
135 | +if (!function_exists('on_prod')) { |
|
136 | 136 | /** |
137 | 137 | * Testez pour voir si nous sommes dans un environnement de production. |
138 | 138 | */ |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | } |
149 | 149 | } |
150 | 150 | |
151 | -if (! function_exists('on_test')) { |
|
151 | +if (!function_exists('on_test')) { |
|
152 | 152 | /** |
153 | 153 | * Testez pour voir si nous sommes dans un environnement de test |
154 | 154 | */ |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | } |
161 | 161 | } |
162 | 162 | |
163 | -if (! function_exists('is_cli')) { |
|
163 | +if (!function_exists('is_cli')) { |
|
164 | 164 | /** |
165 | 165 | * Testez pour voir si une demande a été faite à partir de la ligne de commande. |
166 | 166 | */ |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | } |
171 | 171 | } |
172 | 172 | |
173 | -if (! function_exists('is_php')) { |
|
173 | +if (!function_exists('is_php')) { |
|
174 | 174 | /** |
175 | 175 | * Détermine si la version actuelle de PHP est égale ou supérieure à la valeur fournie. |
176 | 176 | */ |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | } |
181 | 181 | } |
182 | 182 | |
183 | -if (! function_exists('is_windows')) { |
|
183 | +if (!function_exists('is_windows')) { |
|
184 | 184 | /** |
185 | 185 | * Déterminez si l'environnement actuel est basé sur Windows. |
186 | 186 | */ |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | } |
191 | 191 | } |
192 | 192 | |
193 | -if (! function_exists('is_https')) { |
|
193 | +if (!function_exists('is_https')) { |
|
194 | 194 | /** |
195 | 195 | * Determines if the application is accessed via an encrypted * (HTTPS) connection. |
196 | 196 | */ |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | } |
201 | 201 | } |
202 | 202 | |
203 | -if (! function_exists('is_localfile')) { |
|
203 | +if (!function_exists('is_localfile')) { |
|
204 | 204 | /** |
205 | 205 | * Vérifiez si le fichier auquel vous souhaitez accéder est un fichier local de votre application ou non |
206 | 206 | */ |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | } |
212 | 212 | } |
213 | 213 | |
214 | -if (! function_exists('is_online')) { |
|
214 | +if (!function_exists('is_online')) { |
|
215 | 215 | /** |
216 | 216 | * Tester si l'application s'exécute en local ou en ligne. |
217 | 217 | */ |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | } |
222 | 222 | } |
223 | 223 | |
224 | -if (! function_exists('is_ajax_request')) { |
|
224 | +if (!function_exists('is_ajax_request')) { |
|
225 | 225 | /** |
226 | 226 | * Testez pour voir si une requête contient l'en-tête HTTP_X_REQUESTED_WITH. |
227 | 227 | */ |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | |
234 | 234 | // ================================= FONCTIONS DE MANIPULATION D'URL ================================= // |
235 | 235 | |
236 | -if (! function_exists('site_url')) { |
|
236 | +if (!function_exists('site_url')) { |
|
237 | 237 | /** |
238 | 238 | * Renvoie une URL de site telle que définie par la configuration de l'application. |
239 | 239 | * |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | } |
258 | 258 | } |
259 | 259 | |
260 | -if (! function_exists('base_url')) { |
|
260 | +if (!function_exists('base_url')) { |
|
261 | 261 | /** |
262 | 262 | * Créez une URL locale basée sur votre chemin de base. |
263 | 263 | * Les segments peuvent être transmis sous forme de chaîne ou de tableau, comme site_url |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | } |
273 | 273 | } |
274 | 274 | |
275 | -if (! function_exists('current_url')) { |
|
275 | +if (!function_exists('current_url')) { |
|
276 | 276 | /** |
277 | 277 | * Current URL |
278 | 278 | * |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | } |
296 | 296 | } |
297 | 297 | |
298 | -if (! function_exists('previous_url')) { |
|
298 | +if (!function_exists('previous_url')) { |
|
299 | 299 | /** |
300 | 300 | * Renvoie l'URL précédente sur laquelle se trouvait le visiteur actuel. Pour des raisons de sécurité |
301 | 301 | * nous vérifions d'abord une variable de session enregistrée, si elle existe, et l'utilisons. |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | } |
321 | 321 | } |
322 | 322 | |
323 | -if (! function_exists('redirection')) { |
|
323 | +if (!function_exists('redirection')) { |
|
324 | 324 | /** |
325 | 325 | * Redirige l'utilisateur |
326 | 326 | */ |
@@ -334,7 +334,7 @@ discard block |
||
334 | 334 | } |
335 | 335 | } |
336 | 336 | |
337 | -if (! function_exists('redirect')) { |
|
337 | +if (!function_exists('redirect')) { |
|
338 | 338 | /** |
339 | 339 | * Méthode pratique qui fonctionne avec la $request globale actuelle et |
340 | 340 | * l'instance $router à rediriger à l'aide de routes nommées et le routage inversé |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | { |
349 | 349 | $redirection = Services::redirection(); |
350 | 350 | |
351 | - if (! empty($uri)) { |
|
351 | + if (!empty($uri)) { |
|
352 | 352 | return $redirection->route($uri); |
353 | 353 | } |
354 | 354 | |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | } |
357 | 357 | } |
358 | 358 | |
359 | -if (! function_exists('link_to')) { |
|
359 | +if (!function_exists('link_to')) { |
|
360 | 360 | /** |
361 | 361 | * Étant donné une chaîne de contrôleur/méthode et tous les paramètres, |
362 | 362 | * tentera de créer l'URL relative à la route correspondante. |
@@ -372,14 +372,14 @@ discard block |
||
372 | 372 | } |
373 | 373 | } |
374 | 374 | |
375 | -if (! function_exists('clean_url')) { |
|
375 | +if (!function_exists('clean_url')) { |
|
376 | 376 | function clean_url(string $url): string |
377 | 377 | { |
378 | 378 | return Helpers::cleanUrl($url); |
379 | 379 | } |
380 | 380 | } |
381 | 381 | |
382 | -if (! function_exists('clean_path')) { |
|
382 | +if (!function_exists('clean_path')) { |
|
383 | 383 | /** |
384 | 384 | * Une méthode pratique pour nettoyer les chemins pour |
385 | 385 | * une sortie plus belle. Utile pour les exceptions |
@@ -411,7 +411,7 @@ discard block |
||
411 | 411 | |
412 | 412 | // ================================= FONCTIONS DE DEBOGAGE ================================= // |
413 | 413 | |
414 | -if (! function_exists('dd')) { |
|
414 | +if (!function_exists('dd')) { |
|
415 | 415 | /** |
416 | 416 | * Prints a Kint debug report and exits. |
417 | 417 | * |
@@ -428,7 +428,7 @@ discard block |
||
428 | 428 | } |
429 | 429 | } |
430 | 430 | |
431 | -if (! function_exists('deprecationWarning')) { |
|
431 | +if (!function_exists('deprecationWarning')) { |
|
432 | 432 | /** |
433 | 433 | * Méthode d'assistance pour générer des avertissements d'obsolescence |
434 | 434 | * |
@@ -444,7 +444,7 @@ discard block |
||
444 | 444 | } |
445 | 445 | } |
446 | 446 | |
447 | -if (! function_exists('logger')) { |
|
447 | +if (!function_exists('logger')) { |
|
448 | 448 | /** |
449 | 449 | * A convenience/compatibility method for logging events through |
450 | 450 | * the Log system. |
@@ -467,7 +467,7 @@ discard block |
||
467 | 467 | { |
468 | 468 | $logger = Services::logger(); |
469 | 469 | |
470 | - if (! empty($level) && ! empty($message)) { |
|
470 | + if (!empty($level) && !empty($message)) { |
|
471 | 471 | return $logger->log($level, $message, $context); |
472 | 472 | } |
473 | 473 | |
@@ -475,7 +475,7 @@ discard block |
||
475 | 475 | } |
476 | 476 | } |
477 | 477 | |
478 | -if (! function_exists('cache')) { |
|
478 | +if (!function_exists('cache')) { |
|
479 | 479 | /** |
480 | 480 | * Une méthode pratique qui donne accès au cache |
481 | 481 | * objet. Si aucun paramètre n'est fourni, renverra l'objet, |
@@ -505,7 +505,7 @@ discard block |
||
505 | 505 | } |
506 | 506 | } |
507 | 507 | |
508 | -if (! function_exists('pr')) { |
|
508 | +if (!function_exists('pr')) { |
|
509 | 509 | /** |
510 | 510 | * print_r() convenience function. |
511 | 511 | * |
@@ -527,7 +527,7 @@ discard block |
||
527 | 527 | } |
528 | 528 | } |
529 | 529 | |
530 | -if (! function_exists('pj')) { |
|
530 | +if (!function_exists('pj')) { |
|
531 | 531 | /** |
532 | 532 | * json pretty print convenience function. |
533 | 533 | * |
@@ -548,7 +548,7 @@ discard block |
||
548 | 548 | } |
549 | 549 | } |
550 | 550 | |
551 | -if (! function_exists('trigger_warning')) { |
|
551 | +if (!function_exists('trigger_warning')) { |
|
552 | 552 | /** |
553 | 553 | * Déclenche un E_USER_WARNING. |
554 | 554 | */ |
@@ -558,7 +558,7 @@ discard block |
||
558 | 558 | } |
559 | 559 | } |
560 | 560 | |
561 | -if (! function_exists('vd')) { |
|
561 | +if (!function_exists('vd')) { |
|
562 | 562 | /** |
563 | 563 | * Shortcut to ref, HTML mode |
564 | 564 | * |
@@ -570,7 +570,7 @@ discard block |
||
570 | 570 | } |
571 | 571 | } |
572 | 572 | |
573 | -if (! function_exists('vdt')) { |
|
573 | +if (!function_exists('vdt')) { |
|
574 | 574 | /** |
575 | 575 | * Shortcut to ref, plain text mode |
576 | 576 | * |
@@ -584,7 +584,7 @@ discard block |
||
584 | 584 | |
585 | 585 | // ================================= FONCTIONS DIVERSES ================================= // |
586 | 586 | |
587 | -if (! function_exists('force_https')) { |
|
587 | +if (!function_exists('force_https')) { |
|
588 | 588 | /** |
589 | 589 | * Utilisé pour forcer l'accès à une page via HTTPS. |
590 | 590 | * Utilise une redirection standard, plus définira l'en-tête HSTS |
@@ -640,7 +640,7 @@ discard block |
||
640 | 640 | } |
641 | 641 | } |
642 | 642 | |
643 | -if (! function_exists('getTypeName')) { |
|
643 | +if (!function_exists('getTypeName')) { |
|
644 | 644 | /** |
645 | 645 | * Renvoie la classe d'objets ou le type var de ce n'est pas un objet |
646 | 646 | * |
@@ -654,7 +654,7 @@ discard block |
||
654 | 654 | } |
655 | 655 | } |
656 | 656 | |
657 | -if (! function_exists('ip_address')) { |
|
657 | +if (!function_exists('ip_address')) { |
|
658 | 658 | /** |
659 | 659 | * Renvoie l'adresse IP de l'utilisateur actuel |
660 | 660 | */ |
@@ -664,7 +664,7 @@ discard block |
||
664 | 664 | } |
665 | 665 | } |
666 | 666 | |
667 | -if (! function_exists('is_really_writable')) { |
|
667 | +if (!function_exists('is_really_writable')) { |
|
668 | 668 | /** |
669 | 669 | * Tests d'inscriptibilité des fichiers |
670 | 670 | */ |
@@ -675,7 +675,7 @@ discard block |
||
675 | 675 | } |
676 | 676 | } |
677 | 677 | |
678 | -if (! function_exists('lang')) { |
|
678 | +if (!function_exists('lang')) { |
|
679 | 679 | /** |
680 | 680 | * Une méthode pratique pour traduire une chaîne ou un tableau d'entrées et formater |
681 | 681 | * le résultat avec le MessageFormatter de l'extension intl. |
@@ -691,7 +691,7 @@ discard block |
||
691 | 691 | } |
692 | 692 | } |
693 | 693 | |
694 | -if (! function_exists('namespaceSplit')) { |
|
694 | +if (!function_exists('namespaceSplit')) { |
|
695 | 695 | /** |
696 | 696 | * Séparez l'espace de noms du nom de classe. |
697 | 697 | * |
@@ -712,7 +712,7 @@ discard block |
||
712 | 712 | } |
713 | 713 | } |
714 | 714 | |
715 | -if (! function_exists('view_exist')) { |
|
715 | +if (!function_exists('view_exist')) { |
|
716 | 716 | /** |
717 | 717 | * Verifie si un fichier de vue existe. Utile pour limiter les failles include |
718 | 718 | */ |
@@ -726,7 +726,7 @@ discard block |
||
726 | 726 | } |
727 | 727 | } |
728 | 728 | |
729 | -if (! function_exists('view')) { |
|
729 | +if (!function_exists('view')) { |
|
730 | 730 | /** |
731 | 731 | * Charge une vue |
732 | 732 | * |
@@ -742,7 +742,7 @@ discard block |
||
742 | 742 | } |
743 | 743 | } |
744 | 744 | |
745 | -if (! function_exists('flash')) { |
|
745 | +if (!function_exists('flash')) { |
|
746 | 746 | /** |
747 | 747 | * Fournisseur d'acces rapide a la classe PHP Flash |
748 | 748 | * |
@@ -774,7 +774,7 @@ discard block |
||
774 | 774 | }*/ |
775 | 775 | } |
776 | 776 | |
777 | -if (! function_exists('geo_ip')) { |
|
777 | +if (!function_exists('geo_ip')) { |
|
778 | 778 | /** |
779 | 779 | * Recuperation des coordonnees (pays, ville, etc) d'un utilisateur en fonction de son ip |
780 | 780 | */ |
@@ -784,7 +784,7 @@ discard block |
||
784 | 784 | } |
785 | 785 | } |
786 | 786 | |
787 | -if (! function_exists('to_stream')) { |
|
787 | +if (!function_exists('to_stream')) { |
|
788 | 788 | /** |
789 | 789 | * Créez un nouveau flux basé sur le type d'entrée. |
790 | 790 | * |
@@ -807,7 +807,7 @@ discard block |
||
807 | 807 | } |
808 | 808 | } |
809 | 809 | |
810 | -if (! function_exists('value')) { |
|
810 | +if (!function_exists('value')) { |
|
811 | 811 | /** |
812 | 812 | * Renvoie la valeur par défaut de la valeur donnée. |
813 | 813 | * |
@@ -821,7 +821,7 @@ discard block |
||
821 | 821 | } |
822 | 822 | } |
823 | 823 | |
824 | -if (! function_exists('with')) { |
|
824 | +if (!function_exists('with')) { |
|
825 | 825 | /** |
826 | 826 | * Renvoie la valeur donnée, éventuellement transmise via le rappel donné. |
827 | 827 | * |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | $this->renderVars['file'] = str_replace('/', DS, rtrim($this->viewPath, '/\\') . DS . ltrim($this->renderVars['view'], '/\\')); |
61 | 61 | |
62 | 62 | $layout = $this->layout; |
63 | - if (! empty($layout)) { |
|
63 | + if (!empty($layout)) { |
|
64 | 64 | if (empty(pathinfo($layout, PATHINFO_EXTENSION))) { |
65 | 65 | $layout .= '.tpl'; |
66 | 66 | } |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | $this->engine->assign($this->data); |
71 | 71 | |
72 | 72 | // Doit-on mettre en cache? |
73 | - if (! empty($this->renderVars['options']['cache_name']) || ! empty($this->renderVars['options']['cache'])) { |
|
73 | + if (!empty($this->renderVars['options']['cache_name']) || !empty($this->renderVars['options']['cache'])) { |
|
74 | 74 | $this->enableCache(); |
75 | 75 | $this->engine->setCacheLifetime(60 * $this->renderVars['options']['cache'] ?? 60); |
76 | 76 | $this->engine->setCompileId($this->renderVars['options']['cache_name'] ?? null); |
@@ -69,7 +69,7 @@ |
||
69 | 69 | |
70 | 70 | $auto_refresh = $this->config['auto_refresh'] ?? 'auto'; |
71 | 71 | if ($auto_refresh === 'auto') { |
72 | - $auto_refresh = ! is_online(); |
|
72 | + $auto_refresh = !is_online(); |
|
73 | 73 | } |
74 | 74 | $this->latte->setAutoRefresh($auto_refresh); |
75 | 75 |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | |
112 | 112 | $this->renderVars['file'] = str_replace('/', DS, rtrim($this->viewPath, '/\\') . DS . ltrim($this->renderVars['view'], '/\\')); |
113 | 113 | |
114 | - if (! is_file($this->renderVars['file'])) { |
|
114 | + if (!is_file($this->renderVars['file'])) { |
|
115 | 115 | throw ViewException::invalidFile($this->renderVars['view']); |
116 | 116 | } |
117 | 117 | |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | // Enregistrer les variables actuelles |
122 | 122 | $renderVars = $this->renderVars; |
123 | 123 | |
124 | - $output = (function (): string { |
|
124 | + $output = (function(): string { |
|
125 | 125 | extract($this->tempData); |
126 | 126 | ob_start(); |
127 | 127 | include $this->renderVars['file']; |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | |
148 | 148 | $this->logPerformance($this->renderVars['start'], microtime(true), $this->renderVars['view']); |
149 | 149 | |
150 | - if (($this->debug && (! isset($options['debug']) || $options['debug'] === true))) { |
|
150 | + if (($this->debug && (!isset($options['debug']) || $options['debug'] === true))) { |
|
151 | 151 | // Nettoyer nos noms de chemins pour les rendre un peu plus propres |
152 | 152 | $this->renderVars['file'] = clean_path($this->renderVars['file']); |
153 | 153 | $this->renderVars['file'] = ++$this->viewsCount . ' ' . $this->renderVars['file']; |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | $saveData ??= $this->saveData; |
177 | 177 | $this->prepareTemplateData($saveData); |
178 | 178 | |
179 | - $output = (function (string $view): string { |
|
179 | + $output = (function(string $view): string { |
|
180 | 180 | extract($this->tempData); |
181 | 181 | ob_start(); |
182 | 182 | eval('?>' . $view); |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | $section = array_pop($this->sectionStack); |
305 | 305 | |
306 | 306 | // Assurez-vous qu'un tableau existe afin que nous puissions stocker plusieurs entrées pour cela. |
307 | - if (! array_key_exists($section, $this->sections)) { |
|
307 | + if (!array_key_exists($section, $this->sections)) { |
|
308 | 308 | $this->sections[$section] = []; |
309 | 309 | } |
310 | 310 | |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | */ |
339 | 339 | public function show(string $sectionName) |
340 | 340 | { |
341 | - if (! isset($this->sections[$sectionName])) { |
|
341 | + if (!isset($this->sections[$sectionName])) { |
|
342 | 342 | echo ''; |
343 | 343 | |
344 | 344 | return; |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | * |
407 | 407 | * @param mixed $saveData |
408 | 408 | */ |
409 | - public function include(string $view, ?array $data = [], ?array $options = null, $saveData = true): string |
|
409 | + public function include(string $view, ?array $data = [], ?array $options = null, $saveData = true) : string |
|
410 | 410 | { |
411 | 411 | return $this->insert($view, $data, $options, $saveData); |
412 | 412 | } |
@@ -175,10 +175,10 @@ |
||
175 | 175 | */ |
176 | 176 | public function setAdapter(string $adapter, array $config = []): self |
177 | 177 | { |
178 | - if (! array_key_exists($adapter, self::$validAdapters)) { |
|
178 | + if (!array_key_exists($adapter, self::$validAdapters)) { |
|
179 | 179 | $adapter = 'native'; |
180 | 180 | } |
181 | - if (empty($this->config['adapters']) || ! is_array($this->config['adapters'])) { |
|
181 | + if (empty($this->config['adapters']) || !is_array($this->config['adapters'])) { |
|
182 | 182 | $this->config['adapters'] = []; |
183 | 183 | } |
184 | 184 |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | public function __construct(array $events = []) |
48 | 48 | { |
49 | 49 | $this->events = $events; |
50 | - if (! array_key_exists(self::WILDCARD, $this->events)) { |
|
50 | + if (!array_key_exists(self::WILDCARD, $this->events)) { |
|
51 | 51 | $this->events[self::WILDCARD] = []; |
52 | 52 | } |
53 | 53 | } |
@@ -65,14 +65,14 @@ discard block |
||
65 | 65 | */ |
66 | 66 | public function attach(string $event, callable $callback, int $priority = 0): bool |
67 | 67 | { |
68 | - if (! array_key_exists($event, $this->events)) { |
|
68 | + if (!array_key_exists($event, $this->events)) { |
|
69 | 69 | $this->events[$event] = []; |
70 | 70 | } |
71 | - if (! array_key_exists($priority, $this->events[$event])) { |
|
71 | + if (!array_key_exists($priority, $this->events[$event])) { |
|
72 | 72 | $this->events[$event][$priority] = []; |
73 | 73 | } |
74 | 74 | |
75 | - if (! in_array($callback, $this->events[$event][$priority], true)) { |
|
75 | + if (!in_array($callback, $this->events[$event][$priority], true)) { |
|
76 | 76 | $this->events[$event][$priority][] = $callback; |
77 | 77 | |
78 | 78 | return true; |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | */ |
95 | 95 | public function detach(string $event, callable $callback): bool |
96 | 96 | { |
97 | - if (! array_key_exists($event, $this->events) || ! $this->events[$event]) { |
|
97 | + if (!array_key_exists($event, $this->events) || !$this->events[$event]) { |
|
98 | 98 | return false; |
99 | 99 | } |
100 | 100 | |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | */ |
116 | 116 | public function trigger($event, $target = null, $argv = []) |
117 | 117 | { |
118 | - if (! ($event instanceof EventInterface)) { |
|
118 | + if (!($event instanceof EventInterface)) { |
|
119 | 119 | $event = new Event($event, $target, $argv); |
120 | 120 | } else { |
121 | 121 | if ($target) { |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | } |
128 | 128 | |
129 | 129 | $eventName = $event->getName(); |
130 | - if (! array_key_exists($eventName, $this->events)) { |
|
130 | + if (!array_key_exists($eventName, $this->events)) { |
|
131 | 131 | $this->events[$eventName] = []; |
132 | 132 | } |
133 | 133 | |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | $result = null; |
136 | 136 | |
137 | 137 | foreach ($events as $priority) { |
138 | - if (! is_array($priority)) { |
|
138 | + if (!is_array($priority)) { |
|
139 | 139 | continue; |
140 | 140 | } |
141 | 141 |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | public function getLine(string $line, ?array $args = []) |
94 | 94 | { |
95 | 95 | // ignore requests with no file specified |
96 | - if (! strpos($line, '.')) { |
|
96 | + if (!strpos($line, '.')) { |
|
97 | 97 | return $line; |
98 | 98 | } |
99 | 99 | if (empty($args)) { |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | |
131 | 131 | $output ??= $line; |
132 | 132 | |
133 | - if (! empty($args)) { |
|
133 | + if (!empty($args)) { |
|
134 | 134 | $output = $this->formatMessage($output, $args); |
135 | 135 | } |
136 | 136 | |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | $line = implode('.', $line); |
153 | 153 | */ |
154 | 154 | |
155 | - if (! isset($this->language[$locale][$file]) || ! array_key_exists($line, $this->language[$locale][$file])) { |
|
155 | + if (!isset($this->language[$locale][$file]) || !array_key_exists($line, $this->language[$locale][$file])) { |
|
156 | 156 | $this->load($file, $locale); |
157 | 157 | } |
158 | 158 | |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | */ |
173 | 173 | protected function formatMessage($message, array $args = []) |
174 | 174 | { |
175 | - if (! $this->intlSupport || ! $args) { |
|
175 | + if (!$this->intlSupport || !$args) { |
|
176 | 176 | return $message; |
177 | 177 | } |
178 | 178 | |
@@ -196,18 +196,18 @@ discard block |
||
196 | 196 | */ |
197 | 197 | protected function load(string $file, string $locale, bool $return = false) |
198 | 198 | { |
199 | - if (! array_key_exists($locale, $this->loadedFiles)) { |
|
199 | + if (!array_key_exists($locale, $this->loadedFiles)) { |
|
200 | 200 | $this->loadedFiles[$locale] = []; |
201 | 201 | } |
202 | 202 | if (in_array($file, $this->loadedFiles[$locale], true)) { |
203 | 203 | // Don't load it more than once. |
204 | 204 | return []; |
205 | 205 | } |
206 | - if (! array_key_exists($locale, $this->language)) { |
|
206 | + if (!array_key_exists($locale, $this->language)) { |
|
207 | 207 | $this->language[$locale] = []; |
208 | 208 | } |
209 | 209 | |
210 | - if (! array_key_exists($file, $this->language[$locale])) { |
|
210 | + if (!array_key_exists($file, $this->language[$locale])) { |
|
211 | 211 | $this->language[$locale][$file] = []; |
212 | 212 | } |
213 | 213 |