@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | use BlitzPHP\Utilities\String\Inflector; |
13 | 13 | use BlitzPHP\Utilities\String\Text; |
14 | 14 | |
15 | -if (! function_exists('camelize')) { |
|
15 | +if (!function_exists('camelize')) { |
|
16 | 16 | /** |
17 | 17 | * Camelize |
18 | 18 | * |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | } |
27 | 27 | } |
28 | 28 | |
29 | -if (! function_exists('classify')) { |
|
29 | +if (!function_exists('classify')) { |
|
30 | 30 | /** |
31 | 31 | * Returns model class name ("Person" for the database table "people".) for given database table. |
32 | 32 | * |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | } |
41 | 41 | } |
42 | 42 | |
43 | -if (! function_exists('dasherize')) { |
|
43 | +if (!function_exists('dasherize')) { |
|
44 | 44 | /** |
45 | 45 | * Returns the input CamelCasedString as an dashed-string. |
46 | 46 | * |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | } |
57 | 57 | } |
58 | 58 | |
59 | -if (! function_exists('delimit')) { |
|
59 | +if (!function_exists('delimit')) { |
|
60 | 60 | /** |
61 | 61 | * Expects a CamelCasedInputString, and produces a lower_case_delimited_string |
62 | 62 | * |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | } |
72 | 72 | } |
73 | 73 | |
74 | -if (! function_exists('humanize')) { |
|
74 | +if (!function_exists('humanize')) { |
|
75 | 75 | /** |
76 | 76 | * Humanize |
77 | 77 | * |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | } |
87 | 87 | } |
88 | 88 | |
89 | -if (! function_exists('plural')) { |
|
89 | +if (!function_exists('plural')) { |
|
90 | 90 | /** |
91 | 91 | * Plural |
92 | 92 | * |
@@ -94,30 +94,30 @@ discard block |
||
94 | 94 | */ |
95 | 95 | function plural(string $str): string |
96 | 96 | { |
97 | - if (! is_countable($str)) { |
|
97 | + if (!is_countable($str)) { |
|
98 | 98 | return $str; |
99 | 99 | } |
100 | 100 | |
101 | 101 | $plural_rules = [ |
102 | - '/(quiz)$/' => '\1zes', // quizzes |
|
103 | - '/^(ox)$/' => '\1\2en', // ox |
|
104 | - '/([m|l])ouse$/' => '\1ice', // mouse, louse |
|
105 | - '/(matr|vert|ind)ix|ex$/' => '\1ices', // matrix, vertex, index |
|
106 | - '/(x|ch|ss|sh)$/' => '\1es', // search, switch, fix, box, process, address |
|
107 | - '/([^aeiouy]|qu)y$/' => '\1ies', // query, ability, agency |
|
108 | - '/(hive)$/' => '\1s', // archive, hive |
|
109 | - '/(?:([^f])fe|([lr])f)$/' => '\1\2ves', // half, safe, wife |
|
110 | - '/sis$/' => 'ses', // basis, diagnosis |
|
111 | - '/([ti])um$/' => '\1a', // datum, medium |
|
112 | - '/(p)erson$/' => '\1eople', // person, salesperson |
|
113 | - '/(m)an$/' => '\1en', // man, woman, spokesman |
|
114 | - '/(c)hild$/' => '\1hildren', // child |
|
115 | - '/(buffal|tomat)o$/' => '\1\2oes', // buffalo, tomato |
|
116 | - '/(bu|campu)s$/' => '\1\2ses', // bus, campus |
|
117 | - '/(alias|status|virus)$/' => '\1es', // alias |
|
118 | - '/(octop)us$/' => '\1i', // octopus |
|
119 | - '/(ax|cris|test)is$/' => '\1es', // axis, crisis |
|
120 | - '/s$/' => 's', // no change (compatibility) |
|
102 | + '/(quiz)$/' => '\1zes', // quizzes |
|
103 | + '/^(ox)$/' => '\1\2en', // ox |
|
104 | + '/([m|l])ouse$/' => '\1ice', // mouse, louse |
|
105 | + '/(matr|vert|ind)ix|ex$/' => '\1ices', // matrix, vertex, index |
|
106 | + '/(x|ch|ss|sh)$/' => '\1es', // search, switch, fix, box, process, address |
|
107 | + '/([^aeiouy]|qu)y$/' => '\1ies', // query, ability, agency |
|
108 | + '/(hive)$/' => '\1s', // archive, hive |
|
109 | + '/(?:([^f])fe|([lr])f)$/' => '\1\2ves', // half, safe, wife |
|
110 | + '/sis$/' => 'ses', // basis, diagnosis |
|
111 | + '/([ti])um$/' => '\1a', // datum, medium |
|
112 | + '/(p)erson$/' => '\1eople', // person, salesperson |
|
113 | + '/(m)an$/' => '\1en', // man, woman, spokesman |
|
114 | + '/(c)hild$/' => '\1hildren', // child |
|
115 | + '/(buffal|tomat)o$/' => '\1\2oes', // buffalo, tomato |
|
116 | + '/(bu|campu)s$/' => '\1\2ses', // bus, campus |
|
117 | + '/(alias|status|virus)$/' => '\1es', // alias |
|
118 | + '/(octop)us$/' => '\1i', // octopus |
|
119 | + '/(ax|cris|test)is$/' => '\1es', // axis, crisis |
|
120 | + '/s$/' => 's', // no change (compatibility) |
|
121 | 121 | '/$/' => 's', |
122 | 122 | ]; |
123 | 123 | |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | } |
135 | 135 | } |
136 | 136 | |
137 | -if (! function_exists('pluralize')) { |
|
137 | +if (!function_exists('pluralize')) { |
|
138 | 138 | /** |
139 | 139 | * Return $word in plural form. |
140 | 140 | * |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | } |
149 | 149 | } |
150 | 150 | |
151 | -if (! function_exists('singular')) { |
|
151 | +if (!function_exists('singular')) { |
|
152 | 152 | /** |
153 | 153 | * Singular |
154 | 154 | * |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | */ |
157 | 157 | function singular(string $str): string |
158 | 158 | { |
159 | - if (! is_countable($str)) { |
|
159 | + if (!is_countable($str)) { |
|
160 | 160 | return $str; |
161 | 161 | } |
162 | 162 | |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | } |
205 | 205 | } |
206 | 206 | |
207 | -if (! function_exists('singularize')) { |
|
207 | +if (!function_exists('singularize')) { |
|
208 | 208 | /** |
209 | 209 | * Return $word in singular form. |
210 | 210 | * |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | } |
219 | 219 | } |
220 | 220 | |
221 | -if (! function_exists('tableize')) { |
|
221 | +if (!function_exists('tableize')) { |
|
222 | 222 | /** |
223 | 223 | * Returns corresponding table name for given model $className. ("people" for the model class "Person"). |
224 | 224 | * |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | } |
233 | 233 | } |
234 | 234 | |
235 | -if (! function_exists('underscore')) { |
|
235 | +if (!function_exists('underscore')) { |
|
236 | 236 | /** |
237 | 237 | * Underscore |
238 | 238 | * |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | } |
247 | 247 | } |
248 | 248 | |
249 | -if (! function_exists('variable')) { |
|
249 | +if (!function_exists('variable')) { |
|
250 | 250 | /** |
251 | 251 | * Returns camelBacked version of an underscored string. |
252 | 252 | * |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | } |
261 | 261 | } |
262 | 262 | |
263 | -if (! function_exists('counted')) { |
|
263 | +if (!function_exists('counted')) { |
|
264 | 264 | /** |
265 | 265 | * Counted |
266 | 266 | * |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | } |
279 | 279 | } |
280 | 280 | |
281 | -if (! function_exists('pascalize')) { |
|
281 | +if (!function_exists('pascalize')) { |
|
282 | 282 | /** |
283 | 283 | * Pascalize |
284 | 284 | * |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | } |
295 | 295 | } |
296 | 296 | |
297 | -if (! function_exists('is_pluralizable')) { |
|
297 | +if (!function_exists('is_pluralizable')) { |
|
298 | 298 | /** |
299 | 299 | * Checks if the given word has a plural version. |
300 | 300 | * |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | */ |
303 | 303 | function is_pluralizable(string $word): bool |
304 | 304 | { |
305 | - return ! in_array( |
|
305 | + return !in_array( |
|
306 | 306 | strtolower($word), |
307 | 307 | [ |
308 | 308 | 'advice', |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | } |
378 | 378 | } |
379 | 379 | |
380 | -if (! function_exists('ordinal')) { |
|
380 | +if (!function_exists('ordinal')) { |
|
381 | 381 | /** |
382 | 382 | * Returns the suffix that should be added to a |
383 | 383 | * number to denote the position in an ordered |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | } |
405 | 405 | } |
406 | 406 | |
407 | -if (! function_exists('ordinalize')) { |
|
407 | +if (!function_exists('ordinalize')) { |
|
408 | 408 | /** |
409 | 409 | * Turns a number into an ordinal string used |
410 | 410 | * to denote the position in an ordered sequence |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | public function __construct(bool $debug = false) |
33 | 33 | { |
34 | 34 | $this->mailer = new Mailer(); |
35 | - $this->mailer->Debugoutput = static function ($str, $level) { |
|
35 | + $this->mailer->Debugoutput = static function($str, $level) { |
|
36 | 36 | Services::logger()->info('[Mail][' . $level . ']: ' . $str); |
37 | 37 | }; |
38 | 38 | |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | */ |
45 | 45 | public function init(array $config): static |
46 | 46 | { |
47 | - if (! empty($config['username']) && ! empty($config['password'])) { |
|
47 | + if (!empty($config['username']) && !empty($config['password'])) { |
|
48 | 48 | $this->mailer->SMTPAuth = true; |
49 | 49 | } |
50 | 50 |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | |
28 | 28 | // ================================= FONCTIONS UTIILITAIRES ESSENTIELLES ================================= // |
29 | 29 | |
30 | -if (! function_exists('env')) { |
|
30 | +if (!function_exists('env')) { |
|
31 | 31 | /** |
32 | 32 | * Obtient une variable d'environnement à partir des sources disponibles et fournit une émulation |
33 | 33 | * pour les variables d'environnement non prises en charge ou incohérentes |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | } |
44 | 44 | } |
45 | 45 | |
46 | -if (! function_exists('helper')) { |
|
46 | +if (!function_exists('helper')) { |
|
47 | 47 | /** |
48 | 48 | * Charge un fichier d'aide en mémoire. Prend en charge les assistants d'espace de noms, |
49 | 49 | * à la fois dans et hors du répertoire 'helpers' d'un répertoire à espace de noms. |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | } |
60 | 60 | } |
61 | 61 | |
62 | -if (! function_exists('model')) { |
|
62 | +if (!function_exists('model')) { |
|
63 | 63 | /** |
64 | 64 | * Simple maniere d'obtenir un modele. |
65 | 65 | * |
@@ -69,13 +69,13 @@ discard block |
||
69 | 69 | * |
70 | 70 | * @return T |
71 | 71 | */ |
72 | - function model(array|string $name, ?ConnectionInterface &$conn = null) |
|
72 | + function model(array|string $name, ?ConnectionInterface&$conn = null) |
|
73 | 73 | { |
74 | 74 | return Load::model($name, $conn); |
75 | 75 | } |
76 | 76 | } |
77 | 77 | |
78 | -if (! function_exists('service')) { |
|
78 | +if (!function_exists('service')) { |
|
79 | 79 | /** |
80 | 80 | * Permet un accès plus propre au fichier de configuration des services. |
81 | 81 | * Renvoie toujours une instance SHARED de la classe, donc l'appel de la fonction plusieurs fois renvera toujours la même instance. |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | } |
97 | 97 | } |
98 | 98 | |
99 | -if (! function_exists('single_service')) { |
|
99 | +if (!function_exists('single_service')) { |
|
100 | 100 | /** |
101 | 101 | * Autoriser l'accès propre à un service. |
102 | 102 | * Renvoie toujours une nouvelle instance de la classe. |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | } |
117 | 117 | } |
118 | 118 | |
119 | -if (! function_exists('show404')) { |
|
119 | +if (!function_exists('show404')) { |
|
120 | 120 | /** |
121 | 121 | * Afficher une page 404 introuvable dans le navigateur |
122 | 122 | */ |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | } |
127 | 127 | } |
128 | 128 | |
129 | -if (! function_exists('command')) { |
|
129 | +if (!function_exists('command')) { |
|
130 | 130 | /** |
131 | 131 | * Exécute une seule commande. |
132 | 132 | * Entrée attendue dans une seule chaîne comme celle qui serait utilisée sur la ligne de commande elle-même : |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | } |
189 | 189 | } |
190 | 190 | |
191 | -if (! function_exists('config')) { |
|
191 | +if (!function_exists('config')) { |
|
192 | 192 | /** |
193 | 193 | * GET/SET App config |
194 | 194 | * |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | } |
217 | 217 | } |
218 | 218 | |
219 | -if (! function_exists('logger')) { |
|
219 | +if (!function_exists('logger')) { |
|
220 | 220 | /** |
221 | 221 | * Une méthode de commodité pour les événements de journalisation via le système Log. |
222 | 222 | * |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | } |
247 | 247 | } |
248 | 248 | |
249 | -if (! function_exists('cache')) { |
|
249 | +if (!function_exists('cache')) { |
|
250 | 250 | /** |
251 | 251 | * Une méthode pratique qui donne accès au cache |
252 | 252 | * objet. Si aucun paramètre n'est fourni, renverra l'objet, |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | } |
277 | 277 | } |
278 | 278 | |
279 | -if (! function_exists('cookie')) { |
|
279 | +if (!function_exists('cookie')) { |
|
280 | 280 | /** |
281 | 281 | * Une méthode pratique qui donne accès à l'objet cookie. |
282 | 282 | * Si aucun paramètre n'est fourni, renverra l'objet, |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | } |
305 | 305 | } |
306 | 306 | |
307 | -if (! function_exists('session')) { |
|
307 | +if (!function_exists('session')) { |
|
308 | 308 | /** |
309 | 309 | * Une méthode pratique pour accéder à l'instance de session, ou un élément qui a été défini dans la session. |
310 | 310 | * |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | |
330 | 330 | // =========================== FONCTIONS DE PREVENTION D'ATTAQUE =========================== // |
331 | 331 | |
332 | -if (! function_exists('esc')) { |
|
332 | +if (!function_exists('esc')) { |
|
333 | 333 | /** |
334 | 334 | * Effectue un simple échappement automatique des données pour des raisons de sécurité. |
335 | 335 | * Pourrait envisager de rendre cela plus complexe à une date ultérieure. |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | } |
357 | 357 | } |
358 | 358 | |
359 | -if (! function_exists('h')) { |
|
359 | +if (!function_exists('h')) { |
|
360 | 360 | /** |
361 | 361 | * Méthode pratique pour htmlspecialchars. |
362 | 362 | * |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | } |
376 | 376 | } |
377 | 377 | |
378 | -if (! function_exists('purify')) { |
|
378 | +if (!function_exists('purify')) { |
|
379 | 379 | /** |
380 | 380 | * Purifiez l'entrée à l'aide de la classe autonome HTMLPurifier. |
381 | 381 | * Utilisez facilement plusieurs configurations de purificateur. |
@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | } |
392 | 392 | } |
393 | 393 | |
394 | -if (! function_exists('remove_invisible_characters')) { |
|
394 | +if (!function_exists('remove_invisible_characters')) { |
|
395 | 395 | /** |
396 | 396 | * Supprimer les caractères invisibles |
397 | 397 | * |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | } |
405 | 405 | } |
406 | 406 | |
407 | -if (! function_exists('stringify_attributes')) { |
|
407 | +if (!function_exists('stringify_attributes')) { |
|
408 | 408 | /** |
409 | 409 | * Chaîner les attributs à utiliser dans les balises HTML. |
410 | 410 | * |
@@ -418,7 +418,7 @@ discard block |
||
418 | 418 | |
419 | 419 | // ================================= FONCTIONS D'ENVIRONNEMENT D'EXECUTION ================================= // |
420 | 420 | |
421 | -if (! function_exists('environment')) { |
|
421 | +if (!function_exists('environment')) { |
|
422 | 422 | /** |
423 | 423 | * Renvoi l'environnement d'execution actuel ou determine si on est dans un environnement specifie |
424 | 424 | * |
@@ -456,7 +456,7 @@ discard block |
||
456 | 456 | } |
457 | 457 | } |
458 | 458 | |
459 | -if (! function_exists('on_dev')) { |
|
459 | +if (!function_exists('on_dev')) { |
|
460 | 460 | /** |
461 | 461 | * Testez pour voir si nous sommes dans un environnement de développement. |
462 | 462 | */ |
@@ -470,7 +470,7 @@ discard block |
||
470 | 470 | } |
471 | 471 | } |
472 | 472 | |
473 | -if (! function_exists('on_prod')) { |
|
473 | +if (!function_exists('on_prod')) { |
|
474 | 474 | /** |
475 | 475 | * Testez pour voir si nous sommes dans un environnement de production. |
476 | 476 | */ |
@@ -484,7 +484,7 @@ discard block |
||
484 | 484 | } |
485 | 485 | } |
486 | 486 | |
487 | -if (! function_exists('on_test')) { |
|
487 | +if (!function_exists('on_test')) { |
|
488 | 488 | /** |
489 | 489 | * Testez pour voir si nous sommes dans un environnement de test |
490 | 490 | */ |
@@ -494,7 +494,7 @@ discard block |
||
494 | 494 | } |
495 | 495 | } |
496 | 496 | |
497 | -if (! function_exists('is_cli')) { |
|
497 | +if (!function_exists('is_cli')) { |
|
498 | 498 | /** |
499 | 499 | * Testez pour voir si une demande a été faite à partir de la ligne de commande. |
500 | 500 | */ |
@@ -504,7 +504,7 @@ discard block |
||
504 | 504 | } |
505 | 505 | } |
506 | 506 | |
507 | -if (! function_exists('is_php')) { |
|
507 | +if (!function_exists('is_php')) { |
|
508 | 508 | /** |
509 | 509 | * Détermine si la version actuelle de PHP est égale ou supérieure à la valeur fournie. |
510 | 510 | */ |
@@ -514,7 +514,7 @@ discard block |
||
514 | 514 | } |
515 | 515 | } |
516 | 516 | |
517 | -if (! function_exists('is_windows')) { |
|
517 | +if (!function_exists('is_windows')) { |
|
518 | 518 | /** |
519 | 519 | * Déterminez si l'environnement actuel est basé sur Windows. |
520 | 520 | */ |
@@ -524,7 +524,7 @@ discard block |
||
524 | 524 | } |
525 | 525 | } |
526 | 526 | |
527 | -if (! function_exists('is_https')) { |
|
527 | +if (!function_exists('is_https')) { |
|
528 | 528 | /** |
529 | 529 | * Determines if the application is accessed via an encrypted * (HTTPS) connection. |
530 | 530 | */ |
@@ -534,7 +534,7 @@ discard block |
||
534 | 534 | } |
535 | 535 | } |
536 | 536 | |
537 | -if (! function_exists('is_localfile')) { |
|
537 | +if (!function_exists('is_localfile')) { |
|
538 | 538 | /** |
539 | 539 | * Vérifiez si le fichier auquel vous souhaitez accéder est un fichier local de votre application ou non |
540 | 540 | */ |
@@ -544,11 +544,11 @@ discard block |
||
544 | 544 | return true; |
545 | 545 | } |
546 | 546 | |
547 | - return ! preg_match('#^(https?://)#i', $name); |
|
547 | + return !preg_match('#^(https?://)#i', $name); |
|
548 | 548 | } |
549 | 549 | } |
550 | 550 | |
551 | -if (! function_exists('is_online')) { |
|
551 | +if (!function_exists('is_online')) { |
|
552 | 552 | /** |
553 | 553 | * Tester si l'application s'exécute en local ou en ligne. |
554 | 554 | */ |
@@ -558,7 +558,7 @@ discard block |
||
558 | 558 | } |
559 | 559 | } |
560 | 560 | |
561 | -if (! function_exists('is_connected')) { |
|
561 | +if (!function_exists('is_connected')) { |
|
562 | 562 | /** |
563 | 563 | * Verifie si l'utilisateur a une connexion internet active. |
564 | 564 | */ |
@@ -568,7 +568,7 @@ discard block |
||
568 | 568 | } |
569 | 569 | } |
570 | 570 | |
571 | -if (! function_exists('is_ajax_request')) { |
|
571 | +if (!function_exists('is_ajax_request')) { |
|
572 | 572 | /** |
573 | 573 | * Testez pour voir si une requête contient l'en-tête HTTP_X_REQUESTED_WITH. |
574 | 574 | */ |
@@ -578,7 +578,7 @@ discard block |
||
578 | 578 | } |
579 | 579 | } |
580 | 580 | |
581 | -if (! function_exists('redirection')) { |
|
581 | +if (!function_exists('redirection')) { |
|
582 | 582 | /** |
583 | 583 | * Redirige l'utilisateur |
584 | 584 | */ |
@@ -592,7 +592,7 @@ discard block |
||
592 | 592 | } |
593 | 593 | } |
594 | 594 | |
595 | -if (! function_exists('redirect')) { |
|
595 | +if (!function_exists('redirect')) { |
|
596 | 596 | /** |
597 | 597 | * Méthode pratique qui fonctionne avec la $request globale actuelle et |
598 | 598 | * l'instance $router à rediriger à l'aide de routes nommées et le routage inversé |
@@ -606,7 +606,7 @@ discard block |
||
606 | 606 | { |
607 | 607 | $redirection = Services::redirection(); |
608 | 608 | |
609 | - if (! empty($uri)) { |
|
609 | + if (!empty($uri)) { |
|
610 | 610 | return $redirection->route($uri); |
611 | 611 | } |
612 | 612 | |
@@ -614,7 +614,7 @@ discard block |
||
614 | 614 | } |
615 | 615 | } |
616 | 616 | |
617 | -if (! function_exists('back')) { |
|
617 | +if (!function_exists('back')) { |
|
618 | 618 | /** |
619 | 619 | * Retourne a la page precedente |
620 | 620 | * |
@@ -626,7 +626,7 @@ discard block |
||
626 | 626 | } |
627 | 627 | } |
628 | 628 | |
629 | -if (! function_exists('link_to')) { |
|
629 | +if (!function_exists('link_to')) { |
|
630 | 630 | /** |
631 | 631 | * Étant donné une chaîne de contrôleur/méthode et tous les paramètres, |
632 | 632 | * tentera de créer l'URL relative à la route correspondante. |
@@ -646,7 +646,7 @@ discard block |
||
646 | 646 | } |
647 | 647 | } |
648 | 648 | |
649 | -if (! function_exists('clean_path')) { |
|
649 | +if (!function_exists('clean_path')) { |
|
650 | 650 | /** |
651 | 651 | * Une méthode pratique pour nettoyer les chemins pour |
652 | 652 | * une sortie plus belle. Utile pour les exceptions |
@@ -678,7 +678,7 @@ discard block |
||
678 | 678 | } |
679 | 679 | } |
680 | 680 | |
681 | -if (! function_exists('old')) { |
|
681 | +if (!function_exists('old')) { |
|
682 | 682 | /** |
683 | 683 | * Fournit l'accès à "entrée ancienne" qui a été définie dans la session lors d'un redirect()-withInput(). |
684 | 684 | * |
@@ -691,7 +691,7 @@ discard block |
||
691 | 691 | function old(string $key, $default = null, $escape = 'html') |
692 | 692 | { |
693 | 693 | // Assurez-vous de charger la session |
694 | - if (session_status() === PHP_SESSION_NONE && ! on_test()) { |
|
694 | + if (session_status() === PHP_SESSION_NONE && !on_test()) { |
|
695 | 695 | session(); // @codeCoverageIgnore |
696 | 696 | } |
697 | 697 | |
@@ -706,7 +706,7 @@ discard block |
||
706 | 706 | |
707 | 707 | // ================================= FONCTIONS DE DEBOGAGE ================================= // |
708 | 708 | |
709 | -if (! function_exists('deprecationWarning')) { |
|
709 | +if (!function_exists('deprecationWarning')) { |
|
710 | 710 | /** |
711 | 711 | * Méthode d'assistance pour générer des avertissements d'obsolescence |
712 | 712 | * |
@@ -722,7 +722,7 @@ discard block |
||
722 | 722 | } |
723 | 723 | } |
724 | 724 | |
725 | -if (! function_exists('pr')) { |
|
725 | +if (!function_exists('pr')) { |
|
726 | 726 | /** |
727 | 727 | * print_r() convenience function. |
728 | 728 | * |
@@ -744,7 +744,7 @@ discard block |
||
744 | 744 | } |
745 | 745 | } |
746 | 746 | |
747 | -if (! function_exists('pj')) { |
|
747 | +if (!function_exists('pj')) { |
|
748 | 748 | /** |
749 | 749 | * json pretty print convenience function. |
750 | 750 | * |
@@ -765,7 +765,7 @@ discard block |
||
765 | 765 | } |
766 | 766 | } |
767 | 767 | |
768 | -if (! function_exists('trigger_warning')) { |
|
768 | +if (!function_exists('trigger_warning')) { |
|
769 | 769 | /** |
770 | 770 | * Déclenche un E_USER_WARNING. |
771 | 771 | */ |
@@ -777,7 +777,7 @@ discard block |
||
777 | 777 | |
778 | 778 | // ================================= FONCTIONS DIVERSES ================================= // |
779 | 779 | |
780 | -if (! function_exists('force_https')) { |
|
780 | +if (!function_exists('force_https')) { |
|
781 | 781 | /** |
782 | 782 | * Utilisé pour forcer l'accès à une page via HTTPS. |
783 | 783 | * Utilise une redirection standard, plus définira l'en-tête HSTS |
@@ -835,7 +835,7 @@ discard block |
||
835 | 835 | } |
836 | 836 | } |
837 | 837 | |
838 | -if (! function_exists('get_type_name')) { |
|
838 | +if (!function_exists('get_type_name')) { |
|
839 | 839 | /** |
840 | 840 | * Renvoie la classe d'objets ou le type var de ce n'est pas un objet |
841 | 841 | * |
@@ -849,7 +849,7 @@ discard block |
||
849 | 849 | } |
850 | 850 | } |
851 | 851 | |
852 | -if (! function_exists('ip_address')) { |
|
852 | +if (!function_exists('ip_address')) { |
|
853 | 853 | /** |
854 | 854 | * Renvoie l'adresse IP de l'utilisateur actuel |
855 | 855 | */ |
@@ -859,7 +859,7 @@ discard block |
||
859 | 859 | } |
860 | 860 | } |
861 | 861 | |
862 | -if (! function_exists('is_really_writable')) { |
|
862 | +if (!function_exists('is_really_writable')) { |
|
863 | 863 | /** |
864 | 864 | * Tests d'inscriptibilité des fichiers |
865 | 865 | */ |
@@ -869,7 +869,7 @@ discard block |
||
869 | 869 | } |
870 | 870 | } |
871 | 871 | |
872 | -if (! function_exists('lang')) { |
|
872 | +if (!function_exists('lang')) { |
|
873 | 873 | /** |
874 | 874 | * Une méthode pratique pour traduire une chaîne ou un tableau d'entrées et formater |
875 | 875 | * le résultat avec le MessageFormatter de l'extension intl. |
@@ -880,7 +880,7 @@ discard block |
||
880 | 880 | } |
881 | 881 | } |
882 | 882 | |
883 | -if (! function_exists('__')) { |
|
883 | +if (!function_exists('__')) { |
|
884 | 884 | /** |
885 | 885 | * Une méthode pratique pour traduire une chaîne ou un tableau d'entrées et formater |
886 | 886 | * le résultat avec le MessageFormatter de l'extension intl. |
@@ -893,7 +893,7 @@ discard block |
||
893 | 893 | } |
894 | 894 | } |
895 | 895 | |
896 | -if (! function_exists('namespace_split')) { |
|
896 | +if (!function_exists('namespace_split')) { |
|
897 | 897 | /** |
898 | 898 | * Séparez l'espace de noms du nom de classe. |
899 | 899 | * |
@@ -914,7 +914,7 @@ discard block |
||
914 | 914 | } |
915 | 915 | } |
916 | 916 | |
917 | -if (! function_exists('view_exist')) { |
|
917 | +if (!function_exists('view_exist')) { |
|
918 | 918 | /** |
919 | 919 | * Verifie si un fichier de vue existe. Utile pour limiter les failles include |
920 | 920 | */ |
@@ -928,7 +928,7 @@ discard block |
||
928 | 928 | } |
929 | 929 | } |
930 | 930 | |
931 | -if (! function_exists('view')) { |
|
931 | +if (!function_exists('view')) { |
|
932 | 932 | /** |
933 | 933 | * Charge une vue |
934 | 934 | * |
@@ -944,7 +944,7 @@ discard block |
||
944 | 944 | } |
945 | 945 | } |
946 | 946 | |
947 | -if (! function_exists('flash')) { |
|
947 | +if (!function_exists('flash')) { |
|
948 | 948 | /** |
949 | 949 | * Fournisseur d'acces rapide a la classe PHP Flash |
950 | 950 | * |
@@ -976,7 +976,7 @@ discard block |
||
976 | 976 | }*/ |
977 | 977 | } |
978 | 978 | |
979 | -if (! function_exists('geo_ip')) { |
|
979 | +if (!function_exists('geo_ip')) { |
|
980 | 980 | /** |
981 | 981 | * Recuperation des coordonnees (pays, ville, etc) d'un utilisateur en fonction de son ip |
982 | 982 | */ |
@@ -986,7 +986,7 @@ discard block |
||
986 | 986 | } |
987 | 987 | } |
988 | 988 | |
989 | -if (! function_exists('to_stream')) { |
|
989 | +if (!function_exists('to_stream')) { |
|
990 | 990 | /** |
991 | 991 | * Créez un nouveau flux basé sur le type d'entrée. |
992 | 992 | * |
@@ -1007,7 +1007,7 @@ discard block |
||
1007 | 1007 | } |
1008 | 1008 | } |
1009 | 1009 | |
1010 | -if (! function_exists('value')) { |
|
1010 | +if (!function_exists('value')) { |
|
1011 | 1011 | /** |
1012 | 1012 | * Renvoie la valeur par défaut de la valeur donnée. |
1013 | 1013 | */ |
@@ -1017,7 +1017,7 @@ discard block |
||
1017 | 1017 | } |
1018 | 1018 | } |
1019 | 1019 | |
1020 | -if (! function_exists('collect')) { |
|
1020 | +if (!function_exists('collect')) { |
|
1021 | 1021 | /** |
1022 | 1022 | * Créez une collection à partir de la valeur donnée. |
1023 | 1023 | */ |
@@ -1027,7 +1027,7 @@ discard block |
||
1027 | 1027 | } |
1028 | 1028 | } |
1029 | 1029 | |
1030 | -if (! function_exists('with')) { |
|
1030 | +if (!function_exists('with')) { |
|
1031 | 1031 | /** |
1032 | 1032 | * Renvoie la valeur donnée, éventuellement transmise via le rappel donné. |
1033 | 1033 | * |
@@ -1039,7 +1039,7 @@ discard block |
||
1039 | 1039 | } |
1040 | 1040 | } |
1041 | 1041 | |
1042 | -if (! function_exists('tap')) { |
|
1042 | +if (!function_exists('tap')) { |
|
1043 | 1043 | /** |
1044 | 1044 | * Appelez la Closure donnée avec cette instance puis renvoyez l'instance. |
1045 | 1045 | */ |
@@ -1049,7 +1049,7 @@ discard block |
||
1049 | 1049 | } |
1050 | 1050 | } |
1051 | 1051 | |
1052 | -if (! function_exists('last')) { |
|
1052 | +if (!function_exists('last')) { |
|
1053 | 1053 | /** |
1054 | 1054 | * Recupere le dernier element d'un tableau |
1055 | 1055 | */ |
@@ -1059,7 +1059,7 @@ discard block |
||
1059 | 1059 | } |
1060 | 1060 | } |
1061 | 1061 | |
1062 | -if (! function_exists('invade')) { |
|
1062 | +if (!function_exists('invade')) { |
|
1063 | 1063 | /** |
1064 | 1064 | * Cette classe offre une fonction d'invasion qui vous permettra de lire / écrire des propriétés privées d'un objet. |
1065 | 1065 | * Il vous permettra également de définir, obtenir et appeler des méthodes privées. |
@@ -11,10 +11,13 @@ discard block |
||
11 | 11 | use Psr\Http\Server\RequestHandlerInterface; |
12 | 12 | |
13 | 13 | class {class} extends BaseMiddleware implements MiddlewareInterface |
14 | -<?php else: ?> |
|
14 | +<?php else { |
|
15 | + : ?> |
|
15 | 16 | |
16 | 17 | class {class} extends BaseMiddleware |
17 | -<?php endif; ?> |
|
18 | +<?php endif; |
|
19 | +} |
|
20 | +?> |
|
18 | 21 | { |
19 | 22 | /** |
20 | 23 | * Traitez une demande de serveur entrante. |
@@ -26,16 +29,22 @@ discard block |
||
26 | 29 | */ |
27 | 30 | <?php if ($standard === 'psr15'): ?> |
28 | 31 | public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface |
29 | -<?php else: ?> |
|
32 | +<?php else { |
|
33 | + : ?> |
|
30 | 34 | public function __invoke(ServerRequestInterface $request, ResponseInterface $response, callable $next): ResponseInterface |
31 | -<?php endif; ?> |
|
35 | +<?php endif; |
|
36 | +} |
|
37 | +?> |
|
32 | 38 | { |
33 | 39 | // |
34 | 40 | |
35 | 41 | <?php if ($standard === 'psr15'): ?> |
36 | 42 | return $handler->handle($request); |
37 | -<?php else: ?> |
|
43 | +<?php else { |
|
44 | + : ?> |
|
38 | 45 | return $next($request, $response); |
39 | -<?php endif; ?> |
|
46 | +<?php endif; |
|
47 | +} |
|
48 | +?> |
|
40 | 49 | } |
41 | 50 | } |
@@ -78,7 +78,7 @@ |
||
78 | 78 | { |
79 | 79 | $standard = $this->option('standard', 'psr15'); |
80 | 80 | |
81 | - if (! in_array($standard, ['psr15', 'psr7'], true)) { |
|
81 | + if (!in_array($standard, ['psr15', 'psr7'], true)) { |
|
82 | 82 | // @codeCoverageIgnoreStart |
83 | 83 | $standard = $this->choice(lang('CLI.generator.middlewareStandard'), ['psr15', 'psr7'], 'psr15'); |
84 | 84 | $this->eol(); |
@@ -38,7 +38,7 @@ |
||
38 | 38 | $this->arguments = array_merge($this->arguments, $arguments); |
39 | 39 | |
40 | 40 | foreach ($this->arguments as $argument => $value) { |
41 | - if (! is_string($argument)) { |
|
41 | + if (!is_string($argument)) { |
|
42 | 42 | continue; |
43 | 43 | } |
44 | 44 |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | // Incluez le fichier routesFile s'il n'existe pas. |
264 | 264 | // Ne conserver que pour les fins BC pour l'instant. |
265 | 265 | $routeFiles = $this->routeFiles; |
266 | - if (! in_array($routesFile, $routeFiles, true)) { |
|
266 | + if (!in_array($routesFile, $routeFiles, true)) { |
|
267 | 267 | $routeFiles[] = $routesFile; |
268 | 268 | } |
269 | 269 | |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | $routes = $this; |
272 | 272 | |
273 | 273 | foreach ($routeFiles as $routesFile) { |
274 | - if (! is_file($routesFile)) { |
|
274 | + if (!is_file($routesFile)) { |
|
275 | 275 | logger()->warning(sprintf('Fichier de route introuvable : "%s"', $routesFile)); |
276 | 276 | |
277 | 277 | continue; |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | */ |
321 | 321 | public function placeholder(array|string $placeholder, ?string $pattern = null): self |
322 | 322 | { |
323 | - if (! is_array($placeholder)) { |
|
323 | + if (!is_array($placeholder)) { |
|
324 | 324 | $placeholder = [$placeholder => $pattern]; |
325 | 325 | } |
326 | 326 | |
@@ -1023,7 +1023,7 @@ discard block |
||
1023 | 1023 | * |
1024 | 1024 | * @param array|Closure|string $to |
1025 | 1025 | */ |
1026 | - public function match(array $verbs = [], string $from = '', $to = '', ?array $options = null): self |
|
1026 | + public function match(array $verbs = [], string $from = '', $to = '', ?array $options = null) : self |
|
1027 | 1027 | { |
1028 | 1028 | if (empty($from) || empty($to)) { |
1029 | 1029 | throw new InvalidArgumentException('Vous devez fournir les paramètres : $from, $to.'); |
@@ -1212,7 +1212,7 @@ discard block |
||
1212 | 1212 | $from = $route['from']; |
1213 | 1213 | |
1214 | 1214 | // on ignore les closures |
1215 | - if (! is_string($to)) { |
|
1215 | + if (!is_string($to)) { |
|
1216 | 1216 | continue; |
1217 | 1217 | } |
1218 | 1218 | |
@@ -1223,7 +1223,7 @@ discard block |
||
1223 | 1223 | |
1224 | 1224 | // S'il y a une chance de correspondance, alors ce sera |
1225 | 1225 | // soit avec $search au début de la chaîne $to. |
1226 | - if (! str_starts_with($to, $search)) { |
|
1226 | + if (!str_starts_with($to, $search)) { |
|
1227 | 1227 | continue; |
1228 | 1228 | } |
1229 | 1229 | |
@@ -1299,7 +1299,7 @@ discard block |
||
1299 | 1299 | |
1300 | 1300 | // Construisez notre chaîne résultante, en insérant les $params aux endroits appropriés. |
1301 | 1301 | foreach ($matches[0] as $index => $placeholder) { |
1302 | - if (! isset($params[$index])) { |
|
1302 | + if (!isset($params[$index])) { |
|
1303 | 1303 | throw new InvalidArgumentException( |
1304 | 1304 | 'Argument manquant pour "' . $placeholder . '" dans la route "' . $from . '".' |
1305 | 1305 | ); |
@@ -1310,7 +1310,7 @@ discard block |
||
1310 | 1310 | // ou peut-être que $placeholder n'est pas un espace réservé, mais une regex. |
1311 | 1311 | $pattern = $this->placeholders[$placeholderName] ?? $placeholder; |
1312 | 1312 | |
1313 | - if (! preg_match('#^' . $pattern . '$#u', $params[$index])) { |
|
1313 | + if (!preg_match('#^' . $pattern . '$#u', $params[$index])) { |
|
1314 | 1314 | throw RouterException::invalidParameterType(); |
1315 | 1315 | } |
1316 | 1316 | |
@@ -1367,7 +1367,7 @@ discard block |
||
1367 | 1367 | $from = trim($from, '/'); |
1368 | 1368 | } |
1369 | 1369 | |
1370 | - if (is_string($to) && ! str_contains($to, '::') && class_exists($to) && method_exists($to, '__invoke')) { |
|
1370 | + if (is_string($to) && !str_contains($to, '::') && class_exists($to) && method_exists($to, '__invoke')) { |
|
1371 | 1371 | $to = [$to, '__invoke']; |
1372 | 1372 | } |
1373 | 1373 | |
@@ -1379,7 +1379,7 @@ discard block |
||
1379 | 1379 | $options = array_merge($this->currentOptions ?? [], $options ?? []); |
1380 | 1380 | |
1381 | 1381 | if (isset($options['middleware'])) { |
1382 | - if (! isset($options['middlewares'])) { |
|
1382 | + if (!isset($options['middlewares'])) { |
|
1383 | 1383 | $options['middlewares'] = (array) $options['middleware']; |
1384 | 1384 | } |
1385 | 1385 | unset($options['middleware']); |
@@ -1400,9 +1400,9 @@ discard block |
||
1400 | 1400 | } |
1401 | 1401 | |
1402 | 1402 | // Limitation du nom d'hôte ? |
1403 | - if (! empty($options['hostname'])) { |
|
1403 | + if (!empty($options['hostname'])) { |
|
1404 | 1404 | // @todo déterminer s'il existe un moyen de mettre les hôtes sur liste blanche ? |
1405 | - if (! $this->checkHostname($options['hostname'])) { |
|
1405 | + if (!$this->checkHostname($options['hostname'])) { |
|
1406 | 1406 | return; |
1407 | 1407 | } |
1408 | 1408 | |
@@ -1410,10 +1410,10 @@ discard block |
||
1410 | 1410 | } |
1411 | 1411 | |
1412 | 1412 | // Limitation du nom sous-domaine ? |
1413 | - elseif (! empty($options['subdomain'])) { |
|
1413 | + elseif (!empty($options['subdomain'])) { |
|
1414 | 1414 | // Si nous ne correspondons pas au sous-domaine actuel, alors |
1415 | 1415 | // nous n'avons pas besoin d'ajouter la route. |
1416 | - if (! $this->checkSubdomains($options['subdomain'])) { |
|
1416 | + if (!$this->checkSubdomains($options['subdomain'])) { |
|
1417 | 1417 | return; |
1418 | 1418 | } |
1419 | 1419 | |
@@ -1446,9 +1446,9 @@ discard block |
||
1446 | 1446 | } |
1447 | 1447 | |
1448 | 1448 | // S'il s'agit d'une redirection, aucun traitement |
1449 | - if (! isset($options['redirect']) && is_string($to)) { |
|
1449 | + if (!isset($options['redirect']) && is_string($to)) { |
|
1450 | 1450 | // Si aucun espace de noms n'est trouvé, ajouter l'espace de noms par défaut |
1451 | - if (! str_contains($to, '\\') || strpos($to, '\\') > 0) { |
|
1451 | + if (!str_contains($to, '\\') || strpos($to, '\\') > 0) { |
|
1452 | 1452 | $namespace = $options['namespace'] ?? $this->defaultNamespace; |
1453 | 1453 | $to = trim($namespace, '\\') . '\\' . $to; |
1454 | 1454 | } |
@@ -1465,7 +1465,7 @@ discard block |
||
1465 | 1465 | // cela ne fonctionne que parce que les routes découvertes sont ajoutées juste avant |
1466 | 1466 | // pour tenter de router la requête. |
1467 | 1467 | $routeKeyExists = isset($this->routes[$verb][$routeKey]); |
1468 | - if ((isset($this->routesNames[$verb][$name]) || $routeKeyExists) && ! $overwrite) { |
|
1468 | + if ((isset($this->routesNames[$verb][$name]) || $routeKeyExists) && !$overwrite) { |
|
1469 | 1469 | return; |
1470 | 1470 | } |
1471 | 1471 | |
@@ -1491,7 +1491,7 @@ discard block |
||
1491 | 1491 | private function checkHostname(string $hostname): bool |
1492 | 1492 | { |
1493 | 1493 | // Les appels CLI ne peuvent pas être sur le nom d'hôte. |
1494 | - if (! isset($this->httpHost)) { |
|
1494 | + if (!isset($this->httpHost)) { |
|
1495 | 1495 | return false; |
1496 | 1496 | } |
1497 | 1497 | |
@@ -1507,7 +1507,7 @@ discard block |
||
1507 | 1507 | private function checkSubdomains($subdomains): bool |
1508 | 1508 | { |
1509 | 1509 | // Les appels CLI ne peuvent pas être sur le sous-domaine. |
1510 | - if (! isset($this->httpHost)) { |
|
1510 | + if (!isset($this->httpHost)) { |
|
1511 | 1511 | return false; |
1512 | 1512 | } |
1513 | 1513 | |
@@ -1515,13 +1515,13 @@ discard block |
||
1515 | 1515 | $this->currentSubdomain = $this->determineCurrentSubdomain(); |
1516 | 1516 | } |
1517 | 1517 | |
1518 | - if (! is_array($subdomains)) { |
|
1518 | + if (!is_array($subdomains)) { |
|
1519 | 1519 | $subdomains = [$subdomains]; |
1520 | 1520 | } |
1521 | 1521 | |
1522 | 1522 | // Les routes peuvent être limitées à n'importe quel sous-domaine. Dans ce cas, cependant, |
1523 | 1523 | // il nécessite la présence d'un sous-domaine. |
1524 | - if (! empty($this->currentSubdomain) && in_array('*', $subdomains, true)) { |
|
1524 | + if (!empty($this->currentSubdomain) && in_array('*', $subdomains, true)) { |
|
1525 | 1525 | return true; |
1526 | 1526 | } |
1527 | 1527 | |
@@ -1543,7 +1543,7 @@ discard block |
||
1543 | 1543 | // sur l'URL sinon parse_url sera mal interprété |
1544 | 1544 | // 'hôte' comme 'chemin'. |
1545 | 1545 | $url = $this->httpHost; |
1546 | - if (! str_starts_with($url, 'http')) { |
|
1546 | + if (!str_starts_with($url, 'http')) { |
|
1547 | 1547 | $url = 'http://' . $url; |
1548 | 1548 | } |
1549 | 1549 | |
@@ -1584,7 +1584,7 @@ discard block |
||
1584 | 1584 | |
1585 | 1585 | private function getControllerName(Closure|string $handler): ?string |
1586 | 1586 | { |
1587 | - if (! is_string($handler)) { |
|
1587 | + if (!is_string($handler)) { |
|
1588 | 1588 | return null; |
1589 | 1589 | } |
1590 | 1590 | |
@@ -1643,13 +1643,13 @@ discard block |
||
1643 | 1643 | */ |
1644 | 1644 | private function replaceLocale(string $route, ?string $locale = null): string |
1645 | 1645 | { |
1646 | - if (! str_contains($route, '{locale}')) { |
|
1646 | + if (!str_contains($route, '{locale}')) { |
|
1647 | 1647 | return $route; |
1648 | 1648 | } |
1649 | 1649 | |
1650 | 1650 | // Vérifier les paramètres régionaux non valides |
1651 | 1651 | if ($locale !== null) { |
1652 | - if (! in_array($locale, config('app.supported_locales'), true)) { |
|
1652 | + if (!in_array($locale, config('app.supported_locales'), true)) { |
|
1653 | 1653 | $locale = null; |
1654 | 1654 | } |
1655 | 1655 | } |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | $this->cookies = $config['cookies']; |
235 | 235 | |
236 | 236 | if (isset($config['uri'])) { |
237 | - if (! $config['uri'] instanceof UriInterface) { |
|
237 | + if (!$config['uri'] instanceof UriInterface) { |
|
238 | 238 | throw new FrameworkException('The `uri` key must be an instance of ' . UriInterface::class); |
239 | 239 | } |
240 | 240 | $uri = $config['uri']; |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | } |
438 | 438 | |
439 | 439 | $type = strtolower($type); |
440 | - if (! isset(static::$_detectors[$type])) { |
|
440 | + if (!isset(static::$_detectors[$type])) { |
|
441 | 441 | return false; |
442 | 442 | } |
443 | 443 | if ($args) { |
@@ -589,7 +589,7 @@ discard block |
||
589 | 589 | public function isAll(array $types): bool |
590 | 590 | { |
591 | 591 | foreach ($types as $type) { |
592 | - if (! $this->is($type)) { |
|
592 | + if (!$this->is($type)) { |
|
593 | 593 | return false; |
594 | 594 | } |
595 | 595 | } |
@@ -693,7 +693,7 @@ discard block |
||
693 | 693 | protected function normalizeHeaderName(string $name): string |
694 | 694 | { |
695 | 695 | $name = str_replace('-', '_', strtoupper($name)); |
696 | - if (! in_array($name, ['CONTENT_LENGTH', 'CONTENT_TYPE'], true)) { |
|
696 | + if (!in_array($name, ['CONTENT_LENGTH', 'CONTENT_TYPE'], true)) { |
|
697 | 697 | $name = 'HTTP_' . $name; |
698 | 698 | } |
699 | 699 | |
@@ -871,7 +871,7 @@ discard block |
||
871 | 871 | { |
872 | 872 | $new = clone $this; |
873 | 873 | |
874 | - if (! preg_match('/^[!#$%&\'*+.^_`\|~0-9a-z-]+$/i', $method)) { |
|
874 | + if (!preg_match('/^[!#$%&\'*+.^_`\|~0-9a-z-]+$/i', $method)) { |
|
875 | 875 | throw new InvalidArgumentException(sprintf( |
876 | 876 | 'Méthode HTTP non prise en charge "%s" fournie', |
877 | 877 | $method |
@@ -1114,7 +1114,7 @@ discard block |
||
1114 | 1114 | } |
1115 | 1115 | } |
1116 | 1116 | |
1117 | - if (! isset($accept[$prefValue])) { |
|
1117 | + if (!isset($accept[$prefValue])) { |
|
1118 | 1118 | $accept[$prefValue] = []; |
1119 | 1119 | } |
1120 | 1120 | if ($prefValue) { |
@@ -1192,7 +1192,7 @@ discard block |
||
1192 | 1192 | if ($name === null) { |
1193 | 1193 | return $this->data; |
1194 | 1194 | } |
1195 | - if (! is_array($this->data)) { |
|
1195 | + if (!is_array($this->data)) { |
|
1196 | 1196 | return $default; |
1197 | 1197 | } |
1198 | 1198 | |
@@ -1332,7 +1332,7 @@ discard block |
||
1332 | 1332 | */ |
1333 | 1333 | public function withProtocolVersion(string $version): static |
1334 | 1334 | { |
1335 | - if (! preg_match('/^(1\.[01]|2(\.[0])?)$/', $version)) { |
|
1335 | + if (!preg_match('/^(1\.[01]|2(\.[0])?)$/', $version)) { |
|
1336 | 1336 | throw new InvalidArgumentException(sprintf('Version de protocole `%s` non prise en charge fournie.', $version)); |
1337 | 1337 | } |
1338 | 1338 | $new = clone $this; |
@@ -1354,7 +1354,7 @@ discard block |
||
1354 | 1354 | public function getEnv(string $key, ?string $default = null): ?string |
1355 | 1355 | { |
1356 | 1356 | $key = strtoupper($key); |
1357 | - if (! array_key_exists($key, $this->_environment) || null === $this->_environment[$key]) { |
|
1357 | + if (!array_key_exists($key, $this->_environment) || null === $this->_environment[$key]) { |
|
1358 | 1358 | $this->_environment[$key] = env($key); |
1359 | 1359 | } |
1360 | 1360 | |
@@ -1571,7 +1571,7 @@ discard block |
||
1571 | 1571 | $file = Arr::get($this->uploadedFiles, $path); |
1572 | 1572 | if (is_array($file)) { |
1573 | 1573 | foreach ($file as $f) { |
1574 | - if (! ($f instanceof UploadedFile)) { |
|
1574 | + if (!($f instanceof UploadedFile)) { |
|
1575 | 1575 | return null; |
1576 | 1576 | } |
1577 | 1577 | } |
@@ -1579,7 +1579,7 @@ discard block |
||
1579 | 1579 | return $file; |
1580 | 1580 | } |
1581 | 1581 | |
1582 | - if (! ($file instanceof UploadedFileInterface)) { |
|
1582 | + if (!($file instanceof UploadedFileInterface)) { |
|
1583 | 1583 | return null; |
1584 | 1584 | } |
1585 | 1585 | |
@@ -1627,7 +1627,7 @@ discard block |
||
1627 | 1627 | continue; |
1628 | 1628 | } |
1629 | 1629 | |
1630 | - if (! $file instanceof UploadedFileInterface) { |
|
1630 | + if (!$file instanceof UploadedFileInterface) { |
|
1631 | 1631 | throw new InvalidArgumentException("Fichier invalide à '{$path}{$key}'"); |
1632 | 1632 | } |
1633 | 1633 | } |
@@ -1678,7 +1678,7 @@ discard block |
||
1678 | 1678 | } |
1679 | 1679 | |
1680 | 1680 | $host = $uri->getHost(); |
1681 | - if (! $host) { |
|
1681 | + if (!$host) { |
|
1682 | 1682 | return $new; |
1683 | 1683 | } |
1684 | 1684 | $port = $uri->getPort(); |
@@ -1786,7 +1786,7 @@ discard block |
||
1786 | 1786 | $validLocales = config('app.supported_locales'); |
1787 | 1787 | // S'il ne s'agit pas d'un paramètre régional valide, définissez-le |
1788 | 1788 | // aux paramètres régionaux par défaut du site. |
1789 | - if (! in_array($locale, $validLocales, true)) { |
|
1789 | + if (!in_array($locale, $validLocales, true)) { |
|
1790 | 1790 | $locale = config('app.language'); |
1791 | 1791 | } |
1792 | 1792 | |
@@ -1886,7 +1886,7 @@ discard block |
||
1886 | 1886 | $override = true; |
1887 | 1887 | } |
1888 | 1888 | |
1889 | - if ($override && ! in_array($this->_environment['REQUEST_METHOD'], ['PUT', 'POST', 'DELETE', 'PATCH'], true)) { |
|
1889 | + if ($override && !in_array($this->_environment['REQUEST_METHOD'], ['PUT', 'POST', 'DELETE', 'PATCH'], true)) { |
|
1890 | 1890 | $data = []; |
1891 | 1891 | } |
1892 | 1892 | |
@@ -1936,7 +1936,7 @@ discard block |
||
1936 | 1936 | */ |
1937 | 1937 | protected function _processFiles(array $post, array $files): array |
1938 | 1938 | { |
1939 | - if (! is_array($files)) { |
|
1939 | + if (!is_array($files)) { |
|
1940 | 1940 | return $post; |
1941 | 1941 | } |
1942 | 1942 |
@@ -1015,7 +1015,7 @@ discard block |
||
1015 | 1015 | $accept = array_merge($accept, $types); |
1016 | 1016 | } |
1017 | 1017 | |
1018 | - return $accept; |
|
1018 | + return $accept; |
|
1019 | 1019 | } |
1020 | 1020 | |
1021 | 1021 | /** |
@@ -1049,13 +1049,13 @@ discard block |
||
1049 | 1049 | return $accept; |
1050 | 1050 | } |
1051 | 1051 | |
1052 | - foreach ((array) $types as $type) { |
|
1053 | - if (in_array($type, $accept, true)) { |
|
1054 | - return true; |
|
1055 | - } |
|
1056 | - } |
|
1052 | + foreach ((array) $types as $type) { |
|
1053 | + if (in_array($type, $accept, true)) { |
|
1054 | + return true; |
|
1055 | + } |
|
1056 | + } |
|
1057 | 1057 | |
1058 | - return false; |
|
1058 | + return false; |
|
1059 | 1059 | } |
1060 | 1060 | |
1061 | 1061 | /** |
@@ -35,9 +35,9 @@ discard block |
||
35 | 35 | */ |
36 | 36 | public static function registerHttpErrors(Run $debugger, array $config): Run |
37 | 37 | { |
38 | - return $debugger->pushHandler(static function (Throwable $exception, InspectorInterface $inspector, RunInterface $run) use ($config) { |
|
38 | + return $debugger->pushHandler(static function(Throwable $exception, InspectorInterface $inspector, RunInterface $run) use ($config) { |
|
39 | 39 | if (true === $config['log']) { |
40 | - if (! in_array($exception->getCode(), $config['ignore_codes'], true)) { |
|
40 | + if (!in_array($exception->getCode(), $config['ignore_codes'], true)) { |
|
41 | 41 | Services::logger()->error($exception); |
42 | 42 | } |
43 | 43 | } |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | $debugger->pushHandler(new PlainTextHandler()); |
91 | 91 | } |
92 | 92 | |
93 | - if (! is_online()) { |
|
93 | + if (!is_online()) { |
|
94 | 94 | if (Misc::isAjaxRequest() || Services::request()->isJson()) { |
95 | 95 | $debugger->pushHandler(new JsonResponseHandler()); |
96 | 96 | } else { |