@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | $input = $this->all(); |
88 | 88 | |
89 | 89 | foreach ($keys as $value) { |
90 | - if (! Arr::has($input, $value)) { |
|
90 | + if (!Arr::has($input, $value)) { |
|
91 | 91 | return false; |
92 | 92 | } |
93 | 93 | } |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | $keys = is_array($key) ? $key : func_get_args(); |
150 | 150 | |
151 | 151 | foreach ($keys as $value) { |
152 | - if (! $this->isEmptyString($value)) { |
|
152 | + if (!$this->isEmptyString($value)) { |
|
153 | 153 | return false; |
154 | 154 | } |
155 | 155 | } |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | { |
199 | 199 | $keys = is_array($key) ? $key : func_get_args(); |
200 | 200 | |
201 | - return ! $this->has($keys); |
|
201 | + return !$this->has($keys); |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | /** |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | { |
227 | 227 | $value = $this->data($key); |
228 | 228 | |
229 | - return ! is_bool($value) && ! is_array($value) && trim((string) $value) === ''; |
|
229 | + return !is_bool($value) && !is_array($value) && trim((string) $value) === ''; |
|
230 | 230 | } |
231 | 231 | |
232 | 232 | /** |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | { |
247 | 247 | $input = array_replace_recursive($this->data(), $this->allFiles()); |
248 | 248 | |
249 | - if (! $keys) { |
|
249 | + if (!$keys) { |
|
250 | 250 | return $input; |
251 | 251 | } |
252 | 252 | |
@@ -341,9 +341,9 @@ discard block |
||
341 | 341 | public function enum(string $key, $enumClass) |
342 | 342 | { |
343 | 343 | if ($this->isNotFilled($key) |
344 | - || ! function_exists('enum_exists') |
|
345 | - || ! enum_exists($enumClass) |
|
346 | - || ! method_exists($enumClass, 'tryFrom')) { |
|
344 | + || !function_exists('enum_exists') |
|
345 | + || !enum_exists($enumClass) |
|
346 | + || !method_exists($enumClass, 'tryFrom')) { |
|
347 | 347 | return null; |
348 | 348 | } |
349 | 349 | |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | */ |
458 | 458 | public function hasFile(string $key): bool |
459 | 459 | { |
460 | - if (! is_array($files = $this->file($key))) { |
|
460 | + if (!is_array($files = $this->file($key))) { |
|
461 | 461 | $files = [$files]; |
462 | 462 | } |
463 | 463 |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | public function validation(array|string $rules, array $messages = []): Validation |
57 | 57 | { |
58 | 58 | if (is_string($rules)) { |
59 | - if (! class_exists($rules) || ! is_subclass_of($rules, DataValidation::class)) { |
|
59 | + if (!class_exists($rules) || !is_subclass_of($rules, DataValidation::class)) { |
|
60 | 60 | throw new InvalidArgumentException(); |
61 | 61 | } |
62 | 62 | |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | */ |
142 | 142 | public function fullUrl(): string |
143 | 143 | { |
144 | - if (! empty($query = $this->getEnv('QUERY_STRING'))) { |
|
144 | + if (!empty($query = $this->getEnv('QUERY_STRING'))) { |
|
145 | 145 | return $this->url() . '?' . $query; |
146 | 146 | } |
147 | 147 |
@@ -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 |
@@ -1133,7 +1133,7 @@ discard block |
||
1133 | 1133 | } |
1134 | 1134 | } |
1135 | 1135 | |
1136 | - if (! isset($accept[$prefValue])) { |
|
1136 | + if (!isset($accept[$prefValue])) { |
|
1137 | 1137 | $accept[$prefValue] = []; |
1138 | 1138 | } |
1139 | 1139 | if ($prefValue) { |
@@ -1211,7 +1211,7 @@ discard block |
||
1211 | 1211 | if ($name === null) { |
1212 | 1212 | return $this->data; |
1213 | 1213 | } |
1214 | - if (! is_array($this->data)) { |
|
1214 | + if (!is_array($this->data)) { |
|
1215 | 1215 | return $default; |
1216 | 1216 | } |
1217 | 1217 | |
@@ -1351,7 +1351,7 @@ discard block |
||
1351 | 1351 | */ |
1352 | 1352 | public function withProtocolVersion(string $version): static |
1353 | 1353 | { |
1354 | - if (! preg_match('/^(1\.[01]|2(\.[0])?)$/', $version)) { |
|
1354 | + if (!preg_match('/^(1\.[01]|2(\.[0])?)$/', $version)) { |
|
1355 | 1355 | throw new InvalidArgumentException(sprintf('Version de protocole `%s` non prise en charge fournie.', $version)); |
1356 | 1356 | } |
1357 | 1357 | $new = clone $this; |
@@ -1373,7 +1373,7 @@ discard block |
||
1373 | 1373 | public function getEnv(string $key, ?string $default = null): ?string |
1374 | 1374 | { |
1375 | 1375 | $key = strtoupper($key); |
1376 | - if (! array_key_exists($key, $this->_environment) || null === $this->_environment[$key]) { |
|
1376 | + if (!array_key_exists($key, $this->_environment) || null === $this->_environment[$key]) { |
|
1377 | 1377 | $this->_environment[$key] = env($key, $default); |
1378 | 1378 | } |
1379 | 1379 | |
@@ -1590,7 +1590,7 @@ discard block |
||
1590 | 1590 | $file = Arr::get($this->uploadedFiles, $path); |
1591 | 1591 | if (is_array($file)) { |
1592 | 1592 | foreach ($file as $f) { |
1593 | - if (! ($f instanceof UploadedFile)) { |
|
1593 | + if (!($f instanceof UploadedFile)) { |
|
1594 | 1594 | return null; |
1595 | 1595 | } |
1596 | 1596 | } |
@@ -1598,7 +1598,7 @@ discard block |
||
1598 | 1598 | return $file; |
1599 | 1599 | } |
1600 | 1600 | |
1601 | - if (! ($file instanceof UploadedFileInterface)) { |
|
1601 | + if (!($file instanceof UploadedFileInterface)) { |
|
1602 | 1602 | return null; |
1603 | 1603 | } |
1604 | 1604 | |
@@ -1646,7 +1646,7 @@ discard block |
||
1646 | 1646 | continue; |
1647 | 1647 | } |
1648 | 1648 | |
1649 | - if (! $file instanceof UploadedFileInterface) { |
|
1649 | + if (!$file instanceof UploadedFileInterface) { |
|
1650 | 1650 | throw new InvalidArgumentException("Fichier invalide à '{$path}{$key}'"); |
1651 | 1651 | } |
1652 | 1652 | } |
@@ -1697,7 +1697,7 @@ discard block |
||
1697 | 1697 | } |
1698 | 1698 | |
1699 | 1699 | $host = $uri->getHost(); |
1700 | - if (! $host) { |
|
1700 | + if (!$host) { |
|
1701 | 1701 | return $new; |
1702 | 1702 | } |
1703 | 1703 | $port = $uri->getPort(); |
@@ -1805,7 +1805,7 @@ discard block |
||
1805 | 1805 | $validLocales = config('app.supported_locales'); |
1806 | 1806 | // S'il ne s'agit pas d'un paramètre régional valide, définissez-le |
1807 | 1807 | // aux paramètres régionaux par défaut du site. |
1808 | - if (! in_array($locale, $validLocales, true)) { |
|
1808 | + if (!in_array($locale, $validLocales, true)) { |
|
1809 | 1809 | $locale = config('app.language'); |
1810 | 1810 | } |
1811 | 1811 | |
@@ -1905,7 +1905,7 @@ discard block |
||
1905 | 1905 | $override = true; |
1906 | 1906 | } |
1907 | 1907 | |
1908 | - if ($override && ! in_array($this->_environment['REQUEST_METHOD'], ['PUT', 'POST', 'DELETE', 'PATCH'], true)) { |
|
1908 | + if ($override && !in_array($this->_environment['REQUEST_METHOD'], ['PUT', 'POST', 'DELETE', 'PATCH'], true)) { |
|
1909 | 1909 | $data = []; |
1910 | 1910 | } |
1911 | 1911 | |
@@ -1955,7 +1955,7 @@ discard block |
||
1955 | 1955 | */ |
1956 | 1956 | protected function _processFiles(array $post, array $files): array |
1957 | 1957 | { |
1958 | - if (! is_array($files)) { |
|
1958 | + if (!is_array($files)) { |
|
1959 | 1959 | return $post; |
1960 | 1960 | } |
1961 | 1961 |
@@ -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 | * |
@@ -96,30 +96,30 @@ discard block |
||
96 | 96 | { |
97 | 97 | $result = $string; |
98 | 98 | |
99 | - if (! is_pluralizable($result)) { |
|
99 | + if (!is_pluralizable($result)) { |
|
100 | 100 | return $result; |
101 | 101 | } |
102 | 102 | |
103 | 103 | $plural_rules = [ |
104 | - '/(quiz)$/' => '\1zes', // quizzes |
|
105 | - '/^(ox)$/' => '\1\2en', // ox |
|
106 | - '/([m|l])ouse$/' => '\1ice', // mouse, louse |
|
107 | - '/(matr|vert|ind)ix|ex$/' => '\1ices', // matrix, vertex, index |
|
108 | - '/(x|ch|ss|sh)$/' => '\1es', // search, switch, fix, box, process, address |
|
109 | - '/([^aeiouy]|qu)y$/' => '\1ies', // query, ability, agency |
|
110 | - '/(hive)$/' => '\1s', // archive, hive |
|
111 | - '/(?:([^f])fe|([lr])f)$/' => '\1\2ves', // half, safe, wife |
|
112 | - '/sis$/' => 'ses', // basis, diagnosis |
|
113 | - '/([ti])um$/' => '\1a', // datum, medium |
|
114 | - '/(p)erson$/' => '\1eople', // person, salesperson |
|
115 | - '/(m)an$/' => '\1en', // man, woman, spokesman |
|
116 | - '/(c)hild$/' => '\1hildren', // child |
|
117 | - '/(buffal|tomat)o$/' => '\1\2oes', // buffalo, tomato |
|
118 | - '/(bu|campu)s$/' => '\1\2ses', // bus, campus |
|
119 | - '/(alias|status|virus)$/' => '\1es', // alias |
|
120 | - '/(octop)us$/' => '\1i', // octopus |
|
121 | - '/(ax|cris|test)is$/' => '\1es', // axis, crisis |
|
122 | - '/s$/' => 's', // no change (compatibility) |
|
104 | + '/(quiz)$/' => '\1zes', // quizzes |
|
105 | + '/^(ox)$/' => '\1\2en', // ox |
|
106 | + '/([m|l])ouse$/' => '\1ice', // mouse, louse |
|
107 | + '/(matr|vert|ind)ix|ex$/' => '\1ices', // matrix, vertex, index |
|
108 | + '/(x|ch|ss|sh)$/' => '\1es', // search, switch, fix, box, process, address |
|
109 | + '/([^aeiouy]|qu)y$/' => '\1ies', // query, ability, agency |
|
110 | + '/(hive)$/' => '\1s', // archive, hive |
|
111 | + '/(?:([^f])fe|([lr])f)$/' => '\1\2ves', // half, safe, wife |
|
112 | + '/sis$/' => 'ses', // basis, diagnosis |
|
113 | + '/([ti])um$/' => '\1a', // datum, medium |
|
114 | + '/(p)erson$/' => '\1eople', // person, salesperson |
|
115 | + '/(m)an$/' => '\1en', // man, woman, spokesman |
|
116 | + '/(c)hild$/' => '\1hildren', // child |
|
117 | + '/(buffal|tomat)o$/' => '\1\2oes', // buffalo, tomato |
|
118 | + '/(bu|campu)s$/' => '\1\2ses', // bus, campus |
|
119 | + '/(alias|status|virus)$/' => '\1es', // alias |
|
120 | + '/(octop)us$/' => '\1i', // octopus |
|
121 | + '/(ax|cris|test)is$/' => '\1es', // axis, crisis |
|
122 | + '/s$/' => 's', // no change (compatibility) |
|
123 | 123 | '/$/' => 's', |
124 | 124 | ]; |
125 | 125 | |
@@ -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 | * |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | { |
159 | 159 | $result = $string; |
160 | 160 | |
161 | - if (! is_pluralizable($result)) { |
|
161 | + if (!is_pluralizable($result)) { |
|
162 | 162 | return $result; |
163 | 163 | } |
164 | 164 | |
@@ -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 |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | |
29 | 29 | // ================================= FONCTIONS UTIILITAIRES ESSENTIELLES ================================= // |
30 | 30 | |
31 | -if (! function_exists('env')) { |
|
31 | +if (!function_exists('env')) { |
|
32 | 32 | /** |
33 | 33 | * Obtient une variable d'environnement à partir des sources disponibles et fournit une émulation |
34 | 34 | * pour les variables d'environnement non prises en charge ou incohérentes |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | } |
45 | 45 | } |
46 | 46 | |
47 | -if (! function_exists('helper')) { |
|
47 | +if (!function_exists('helper')) { |
|
48 | 48 | /** |
49 | 49 | * Charge un fichier d'aide en mémoire. Prend en charge les assistants d'espace de noms, |
50 | 50 | * à la fois dans et hors du répertoire 'helpers' d'un répertoire à espace de noms. |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | } |
61 | 61 | } |
62 | 62 | |
63 | -if (! function_exists('model')) { |
|
63 | +if (!function_exists('model')) { |
|
64 | 64 | /** |
65 | 65 | * Simple maniere d'obtenir un modele. |
66 | 66 | * |
@@ -70,13 +70,13 @@ discard block |
||
70 | 70 | * |
71 | 71 | * @return T |
72 | 72 | */ |
73 | - function model(array|string $name, ?ConnectionInterface &$conn = null) |
|
73 | + function model(array|string $name, ?ConnectionInterface&$conn = null) |
|
74 | 74 | { |
75 | 75 | return Load::model($name, $conn); |
76 | 76 | } |
77 | 77 | } |
78 | 78 | |
79 | -if (! function_exists('service')) { |
|
79 | +if (!function_exists('service')) { |
|
80 | 80 | /** |
81 | 81 | * Permet un accès plus propre au fichier de configuration des services. |
82 | 82 | * Renvoie toujours une instance SHARED de la classe, donc l'appel de la fonction plusieurs fois renvera toujours la même instance. |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | } |
98 | 98 | } |
99 | 99 | |
100 | -if (! function_exists('single_service')) { |
|
100 | +if (!function_exists('single_service')) { |
|
101 | 101 | /** |
102 | 102 | * Autoriser l'accès propre à un service. |
103 | 103 | * Renvoie toujours une nouvelle instance de la classe. |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | } |
118 | 118 | } |
119 | 119 | |
120 | -if (! function_exists('show404')) { |
|
120 | +if (!function_exists('show404')) { |
|
121 | 121 | /** |
122 | 122 | * Afficher une page 404 introuvable dans le navigateur |
123 | 123 | */ |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | } |
128 | 128 | } |
129 | 129 | |
130 | -if (! function_exists('command')) { |
|
130 | +if (!function_exists('command')) { |
|
131 | 131 | /** |
132 | 132 | * Exécute une seule commande. |
133 | 133 | * Entrée attendue dans une seule chaîne comme celle qui serait utilisée sur la ligne de commande elle-même : |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | } |
190 | 190 | } |
191 | 191 | |
192 | -if (! function_exists('config')) { |
|
192 | +if (!function_exists('config')) { |
|
193 | 193 | /** |
194 | 194 | * GET/SET App config |
195 | 195 | * |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | } |
218 | 218 | } |
219 | 219 | |
220 | -if (! function_exists('logger')) { |
|
220 | +if (!function_exists('logger')) { |
|
221 | 221 | /** |
222 | 222 | * Une méthode de commodité pour les événements de journalisation via le système Log. |
223 | 223 | * |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | } |
248 | 248 | } |
249 | 249 | |
250 | -if (! function_exists('cache')) { |
|
250 | +if (!function_exists('cache')) { |
|
251 | 251 | /** |
252 | 252 | * Une méthode pratique qui donne accès au cache |
253 | 253 | * objet. Si aucun paramètre n'est fourni, renverra l'objet, |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | } |
278 | 278 | } |
279 | 279 | |
280 | -if (! function_exists('cookie')) { |
|
280 | +if (!function_exists('cookie')) { |
|
281 | 281 | /** |
282 | 282 | * Une méthode pratique qui donne accès à l'objet cookie. |
283 | 283 | * Si aucun paramètre n'est fourni, renverra l'objet, |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | } |
306 | 306 | } |
307 | 307 | |
308 | -if (! function_exists('session')) { |
|
308 | +if (!function_exists('session')) { |
|
309 | 309 | /** |
310 | 310 | * Une méthode pratique pour accéder à l'instance de session, ou un élément qui a été défini dans la session. |
311 | 311 | * |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | |
331 | 331 | // =========================== FONCTIONS DE PREVENTION D'ATTAQUE =========================== // |
332 | 332 | |
333 | -if (! function_exists('esc')) { |
|
333 | +if (!function_exists('esc')) { |
|
334 | 334 | /** |
335 | 335 | * Effectue un simple échappement automatique des données pour des raisons de sécurité. |
336 | 336 | * Pourrait envisager de rendre cela plus complexe à une date ultérieure. |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | } |
358 | 358 | } |
359 | 359 | |
360 | -if (! function_exists('h')) { |
|
360 | +if (!function_exists('h')) { |
|
361 | 361 | /** |
362 | 362 | * Méthode pratique pour htmlspecialchars. |
363 | 363 | * |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | } |
377 | 377 | } |
378 | 378 | |
379 | -if (! function_exists('purify')) { |
|
379 | +if (!function_exists('purify')) { |
|
380 | 380 | /** |
381 | 381 | * Purifiez l'entrée à l'aide de la classe autonome HTMLPurifier. |
382 | 382 | * Utilisez facilement plusieurs configurations de purificateur. |
@@ -392,7 +392,7 @@ discard block |
||
392 | 392 | } |
393 | 393 | } |
394 | 394 | |
395 | -if (! function_exists('remove_invisible_characters')) { |
|
395 | +if (!function_exists('remove_invisible_characters')) { |
|
396 | 396 | /** |
397 | 397 | * Supprimer les caractères invisibles |
398 | 398 | * |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | } |
406 | 406 | } |
407 | 407 | |
408 | -if (! function_exists('stringify_attributes')) { |
|
408 | +if (!function_exists('stringify_attributes')) { |
|
409 | 409 | /** |
410 | 410 | * Chaîner les attributs à utiliser dans les balises HTML. |
411 | 411 | * |
@@ -419,7 +419,7 @@ discard block |
||
419 | 419 | |
420 | 420 | // ================================= FONCTIONS D'ENVIRONNEMENT D'EXECUTION ================================= // |
421 | 421 | |
422 | -if (! function_exists('environment')) { |
|
422 | +if (!function_exists('environment')) { |
|
423 | 423 | /** |
424 | 424 | * Renvoi l'environnement d'execution actuel ou determine si on est dans un environnement specifie |
425 | 425 | * |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | } |
458 | 458 | } |
459 | 459 | |
460 | -if (! function_exists('on_dev')) { |
|
460 | +if (!function_exists('on_dev')) { |
|
461 | 461 | /** |
462 | 462 | * Testez pour voir si nous sommes dans un environnement de développement. |
463 | 463 | */ |
@@ -471,7 +471,7 @@ discard block |
||
471 | 471 | } |
472 | 472 | } |
473 | 473 | |
474 | -if (! function_exists('on_prod')) { |
|
474 | +if (!function_exists('on_prod')) { |
|
475 | 475 | /** |
476 | 476 | * Testez pour voir si nous sommes dans un environnement de production. |
477 | 477 | */ |
@@ -485,7 +485,7 @@ discard block |
||
485 | 485 | } |
486 | 486 | } |
487 | 487 | |
488 | -if (! function_exists('on_test')) { |
|
488 | +if (!function_exists('on_test')) { |
|
489 | 489 | /** |
490 | 490 | * Testez pour voir si nous sommes dans un environnement de test |
491 | 491 | */ |
@@ -495,7 +495,7 @@ discard block |
||
495 | 495 | } |
496 | 496 | } |
497 | 497 | |
498 | -if (! function_exists('is_cli')) { |
|
498 | +if (!function_exists('is_cli')) { |
|
499 | 499 | /** |
500 | 500 | * Testez pour voir si une demande a été faite à partir de la ligne de commande. |
501 | 501 | */ |
@@ -505,7 +505,7 @@ discard block |
||
505 | 505 | } |
506 | 506 | } |
507 | 507 | |
508 | -if (! function_exists('is_php')) { |
|
508 | +if (!function_exists('is_php')) { |
|
509 | 509 | /** |
510 | 510 | * Détermine si la version actuelle de PHP est égale ou supérieure à la valeur fournie. |
511 | 511 | */ |
@@ -515,7 +515,7 @@ discard block |
||
515 | 515 | } |
516 | 516 | } |
517 | 517 | |
518 | -if (! function_exists('is_windows')) { |
|
518 | +if (!function_exists('is_windows')) { |
|
519 | 519 | /** |
520 | 520 | * Déterminez si l'environnement actuel est basé sur Windows. |
521 | 521 | */ |
@@ -525,7 +525,7 @@ discard block |
||
525 | 525 | } |
526 | 526 | } |
527 | 527 | |
528 | -if (! function_exists('is_https')) { |
|
528 | +if (!function_exists('is_https')) { |
|
529 | 529 | /** |
530 | 530 | * Determines if the application is accessed via an encrypted * (HTTPS) connection. |
531 | 531 | */ |
@@ -535,7 +535,7 @@ discard block |
||
535 | 535 | } |
536 | 536 | } |
537 | 537 | |
538 | -if (! function_exists('is_localfile')) { |
|
538 | +if (!function_exists('is_localfile')) { |
|
539 | 539 | /** |
540 | 540 | * Vérifiez si le fichier auquel vous souhaitez accéder est un fichier local de votre application ou non |
541 | 541 | */ |
@@ -545,11 +545,11 @@ discard block |
||
545 | 545 | return true; |
546 | 546 | } |
547 | 547 | |
548 | - return ! preg_match('#^(https?://)#i', $name); |
|
548 | + return !preg_match('#^(https?://)#i', $name); |
|
549 | 549 | } |
550 | 550 | } |
551 | 551 | |
552 | -if (! function_exists('is_online')) { |
|
552 | +if (!function_exists('is_online')) { |
|
553 | 553 | /** |
554 | 554 | * Tester si l'application s'exécute en local ou en ligne. |
555 | 555 | */ |
@@ -559,7 +559,7 @@ discard block |
||
559 | 559 | } |
560 | 560 | } |
561 | 561 | |
562 | -if (! function_exists('is_connected')) { |
|
562 | +if (!function_exists('is_connected')) { |
|
563 | 563 | /** |
564 | 564 | * Verifie si l'utilisateur a une connexion internet active. |
565 | 565 | */ |
@@ -569,7 +569,7 @@ discard block |
||
569 | 569 | } |
570 | 570 | } |
571 | 571 | |
572 | -if (! function_exists('is_ajax_request')) { |
|
572 | +if (!function_exists('is_ajax_request')) { |
|
573 | 573 | /** |
574 | 574 | * Testez pour voir si une requête contient l'en-tête HTTP_X_REQUESTED_WITH. |
575 | 575 | */ |
@@ -579,7 +579,7 @@ discard block |
||
579 | 579 | } |
580 | 580 | } |
581 | 581 | |
582 | -if (! function_exists('redirection')) { |
|
582 | +if (!function_exists('redirection')) { |
|
583 | 583 | /** |
584 | 584 | * Redirige l'utilisateur |
585 | 585 | */ |
@@ -593,7 +593,7 @@ discard block |
||
593 | 593 | } |
594 | 594 | } |
595 | 595 | |
596 | -if (! function_exists('redirect')) { |
|
596 | +if (!function_exists('redirect')) { |
|
597 | 597 | /** |
598 | 598 | * Méthode pratique qui fonctionne avec la $request globale actuelle et |
599 | 599 | * l'instance $router à rediriger à l'aide de routes nommées et le routage inversé |
@@ -607,7 +607,7 @@ discard block |
||
607 | 607 | { |
608 | 608 | $redirection = Services::redirection(); |
609 | 609 | |
610 | - if (! empty($uri)) { |
|
610 | + if (!empty($uri)) { |
|
611 | 611 | return $redirection->route($uri); |
612 | 612 | } |
613 | 613 | |
@@ -615,7 +615,7 @@ discard block |
||
615 | 615 | } |
616 | 616 | } |
617 | 617 | |
618 | -if (! function_exists('back')) { |
|
618 | +if (!function_exists('back')) { |
|
619 | 619 | /** |
620 | 620 | * Retourne a la page precedente |
621 | 621 | * |
@@ -627,7 +627,7 @@ discard block |
||
627 | 627 | } |
628 | 628 | } |
629 | 629 | |
630 | -if (! function_exists('link_to')) { |
|
630 | +if (!function_exists('link_to')) { |
|
631 | 631 | /** |
632 | 632 | * Étant donné une chaîne de contrôleur/méthode et tous les paramètres, |
633 | 633 | * tentera de créer l'URL relative à la route correspondante. |
@@ -647,7 +647,7 @@ discard block |
||
647 | 647 | } |
648 | 648 | } |
649 | 649 | |
650 | -if (! function_exists('clean_path')) { |
|
650 | +if (!function_exists('clean_path')) { |
|
651 | 651 | /** |
652 | 652 | * Une méthode pratique pour nettoyer les chemins pour |
653 | 653 | * une sortie plus belle. Utile pour les exceptions |
@@ -679,7 +679,7 @@ discard block |
||
679 | 679 | } |
680 | 680 | } |
681 | 681 | |
682 | -if (! function_exists('old')) { |
|
682 | +if (!function_exists('old')) { |
|
683 | 683 | /** |
684 | 684 | * Fournit l'accès à "entrée ancienne" qui a été définie dans la session lors d'un redirect()-withInput(). |
685 | 685 | * |
@@ -692,7 +692,7 @@ discard block |
||
692 | 692 | function old(string $key, $default = null, $escape = 'html') |
693 | 693 | { |
694 | 694 | // Assurez-vous de charger la session |
695 | - if (session_status() === PHP_SESSION_NONE && ! on_test()) { |
|
695 | + if (session_status() === PHP_SESSION_NONE && !on_test()) { |
|
696 | 696 | session(); // @codeCoverageIgnore |
697 | 697 | } |
698 | 698 | |
@@ -707,7 +707,7 @@ discard block |
||
707 | 707 | |
708 | 708 | // ================================= FONCTIONS DE DEBOGAGE ================================= // |
709 | 709 | |
710 | -if (! function_exists('deprecationWarning')) { |
|
710 | +if (!function_exists('deprecationWarning')) { |
|
711 | 711 | /** |
712 | 712 | * Méthode d'assistance pour générer des avertissements d'obsolescence |
713 | 713 | * |
@@ -723,7 +723,7 @@ discard block |
||
723 | 723 | } |
724 | 724 | } |
725 | 725 | |
726 | -if (! function_exists('pr')) { |
|
726 | +if (!function_exists('pr')) { |
|
727 | 727 | /** |
728 | 728 | * print_r() convenience function. |
729 | 729 | * |
@@ -745,7 +745,7 @@ discard block |
||
745 | 745 | } |
746 | 746 | } |
747 | 747 | |
748 | -if (! function_exists('pj')) { |
|
748 | +if (!function_exists('pj')) { |
|
749 | 749 | /** |
750 | 750 | * json pretty print convenience function. |
751 | 751 | * |
@@ -766,7 +766,7 @@ discard block |
||
766 | 766 | } |
767 | 767 | } |
768 | 768 | |
769 | -if (! function_exists('trigger_warning')) { |
|
769 | +if (!function_exists('trigger_warning')) { |
|
770 | 770 | /** |
771 | 771 | * Déclenche un E_USER_WARNING. |
772 | 772 | */ |
@@ -778,7 +778,7 @@ discard block |
||
778 | 778 | |
779 | 779 | // ================================= FONCTIONS DIVERSES ================================= // |
780 | 780 | |
781 | -if (! function_exists('force_https')) { |
|
781 | +if (!function_exists('force_https')) { |
|
782 | 782 | /** |
783 | 783 | * Utilisé pour forcer l'accès à une page via HTTPS. |
784 | 784 | * Utilise une redirection standard, plus définira l'en-tête HSTS |
@@ -805,7 +805,7 @@ discard block |
||
805 | 805 | |
806 | 806 | // Si la session est active, nous devons régénérer |
807 | 807 | // l'ID de session pour des raisons de sécurité. |
808 | - if (! on_test() && session_status() === PHP_SESSION_ACTIVE) { |
|
808 | + if (!on_test() && session_status() === PHP_SESSION_ACTIVE) { |
|
809 | 809 | Services::session()->regenerate(); // @codeCoverageIgnore |
810 | 810 | } |
811 | 811 | |
@@ -821,7 +821,7 @@ discard block |
||
821 | 821 | } |
822 | 822 | } |
823 | 823 | |
824 | -if (! function_exists('get_type_name')) { |
|
824 | +if (!function_exists('get_type_name')) { |
|
825 | 825 | /** |
826 | 826 | * Renvoie la classe d'objets ou le type var de ce n'est pas un objet |
827 | 827 | * |
@@ -835,7 +835,7 @@ discard block |
||
835 | 835 | } |
836 | 836 | } |
837 | 837 | |
838 | -if (! function_exists('ip_address')) { |
|
838 | +if (!function_exists('ip_address')) { |
|
839 | 839 | /** |
840 | 840 | * Renvoie l'adresse IP de l'utilisateur actuel |
841 | 841 | */ |
@@ -845,7 +845,7 @@ discard block |
||
845 | 845 | } |
846 | 846 | } |
847 | 847 | |
848 | -if (! function_exists('is_really_writable')) { |
|
848 | +if (!function_exists('is_really_writable')) { |
|
849 | 849 | /** |
850 | 850 | * Tests d'inscriptibilité des fichiers |
851 | 851 | */ |
@@ -855,7 +855,7 @@ discard block |
||
855 | 855 | } |
856 | 856 | } |
857 | 857 | |
858 | -if (! function_exists('lang')) { |
|
858 | +if (!function_exists('lang')) { |
|
859 | 859 | /** |
860 | 860 | * Une méthode pratique pour traduire une chaîne ou un tableau d'entrées et formater |
861 | 861 | * le résultat avec le MessageFormatter de l'extension intl. |
@@ -866,7 +866,7 @@ discard block |
||
866 | 866 | } |
867 | 867 | } |
868 | 868 | |
869 | -if (! function_exists('__')) { |
|
869 | +if (!function_exists('__')) { |
|
870 | 870 | /** |
871 | 871 | * Une méthode pratique pour traduire une chaîne ou un tableau d'entrées et formater |
872 | 872 | * le résultat avec le MessageFormatter de l'extension intl. |
@@ -879,7 +879,7 @@ discard block |
||
879 | 879 | } |
880 | 880 | } |
881 | 881 | |
882 | -if (! function_exists('namespace_split')) { |
|
882 | +if (!function_exists('namespace_split')) { |
|
883 | 883 | /** |
884 | 884 | * Séparez l'espace de noms du nom de classe. |
885 | 885 | * |
@@ -900,7 +900,7 @@ discard block |
||
900 | 900 | } |
901 | 901 | } |
902 | 902 | |
903 | -if (! function_exists('view_exist')) { |
|
903 | +if (!function_exists('view_exist')) { |
|
904 | 904 | /** |
905 | 905 | * Verifie si un fichier de vue existe. Utile pour limiter les failles include |
906 | 906 | */ |
@@ -914,7 +914,7 @@ discard block |
||
914 | 914 | } |
915 | 915 | } |
916 | 916 | |
917 | -if (! function_exists('view')) { |
|
917 | +if (!function_exists('view')) { |
|
918 | 918 | /** |
919 | 919 | * Charge une vue |
920 | 920 | * |
@@ -930,7 +930,7 @@ discard block |
||
930 | 930 | } |
931 | 931 | } |
932 | 932 | |
933 | -if (! function_exists('flash')) { |
|
933 | +if (!function_exists('flash')) { |
|
934 | 934 | /** |
935 | 935 | * Fournisseur d'acces rapide a la classe PHP Flash |
936 | 936 | * |
@@ -962,7 +962,7 @@ discard block |
||
962 | 962 | }*/ |
963 | 963 | } |
964 | 964 | |
965 | -if (! function_exists('geo_ip')) { |
|
965 | +if (!function_exists('geo_ip')) { |
|
966 | 966 | /** |
967 | 967 | * Recuperation des coordonnees (pays, ville, etc) d'un utilisateur en fonction de son ip |
968 | 968 | */ |
@@ -972,7 +972,7 @@ discard block |
||
972 | 972 | } |
973 | 973 | } |
974 | 974 | |
975 | -if (! function_exists('to_stream')) { |
|
975 | +if (!function_exists('to_stream')) { |
|
976 | 976 | /** |
977 | 977 | * Créez un nouveau flux basé sur le type d'entrée. |
978 | 978 | * |
@@ -993,7 +993,7 @@ discard block |
||
993 | 993 | } |
994 | 994 | } |
995 | 995 | |
996 | -if (! function_exists('value')) { |
|
996 | +if (!function_exists('value')) { |
|
997 | 997 | /** |
998 | 998 | * Renvoie la valeur par défaut de la valeur donnée. |
999 | 999 | */ |
@@ -1003,7 +1003,7 @@ discard block |
||
1003 | 1003 | } |
1004 | 1004 | } |
1005 | 1005 | |
1006 | -if (! function_exists('collect')) { |
|
1006 | +if (!function_exists('collect')) { |
|
1007 | 1007 | /** |
1008 | 1008 | * Créez une collection à partir de la valeur donnée. |
1009 | 1009 | */ |
@@ -1013,7 +1013,7 @@ discard block |
||
1013 | 1013 | } |
1014 | 1014 | } |
1015 | 1015 | |
1016 | -if (! function_exists('with')) { |
|
1016 | +if (!function_exists('with')) { |
|
1017 | 1017 | /** |
1018 | 1018 | * Renvoie la valeur donnée, éventuellement transmise via le rappel donné. |
1019 | 1019 | * |
@@ -1025,7 +1025,7 @@ discard block |
||
1025 | 1025 | } |
1026 | 1026 | } |
1027 | 1027 | |
1028 | -if (! function_exists('tap')) { |
|
1028 | +if (!function_exists('tap')) { |
|
1029 | 1029 | /** |
1030 | 1030 | * Appelez la Closure donnée avec cette instance puis renvoyez l'instance. |
1031 | 1031 | */ |
@@ -1035,7 +1035,7 @@ discard block |
||
1035 | 1035 | } |
1036 | 1036 | } |
1037 | 1037 | |
1038 | -if (! function_exists('last')) { |
|
1038 | +if (!function_exists('last')) { |
|
1039 | 1039 | /** |
1040 | 1040 | * Recupere le dernier element d'un tableau |
1041 | 1041 | */ |
@@ -1045,7 +1045,7 @@ discard block |
||
1045 | 1045 | } |
1046 | 1046 | } |
1047 | 1047 | |
1048 | -if (! function_exists('invade')) { |
|
1048 | +if (!function_exists('invade')) { |
|
1049 | 1049 | /** |
1050 | 1050 | * Cette classe offre une fonction d'invasion qui vous permettra de lire / écrire des propriétés privées d'un objet. |
1051 | 1051 | * Il vous permettra également de définir, obtenir et appeler des méthodes privées. |
@@ -26,7 +26,7 @@ |
||
26 | 26 | { |
27 | 27 | $response = $handler->handle($request); |
28 | 28 | |
29 | - if (! empty($body = $response->getBody()->getContents())) { |
|
29 | + if (!empty($body = $response->getBody()->getContents())) { |
|
30 | 30 | $benchmark = Services::timer(); |
31 | 31 | |
32 | 32 | $output = str_replace( |
@@ -37,7 +37,7 @@ |
||
37 | 37 | $response = $handler->handle($request); |
38 | 38 | $content = $response->getBody()->getContents(); |
39 | 39 | |
40 | - if (! $response instanceof Redirection) { |
|
40 | + if (!$response instanceof Redirection) { |
|
41 | 41 | // Mettez-le en cache sans remplacer les mesures de performances afin que nous puissions avoir des mises à jour de vitesse en direct en cours de route. |
42 | 42 | // Doit être exécuté après les filtres pour conserver les en-têtes de réponse. |
43 | 43 | $this->pageCache->make($request, $response->withBody(to_stream($content))); |
@@ -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.'); |
@@ -1214,7 +1214,7 @@ discard block |
||
1214 | 1214 | $from = $route['from']; |
1215 | 1215 | |
1216 | 1216 | // on ignore les closures |
1217 | - if (! is_string($to)) { |
|
1217 | + if (!is_string($to)) { |
|
1218 | 1218 | continue; |
1219 | 1219 | } |
1220 | 1220 | |
@@ -1225,7 +1225,7 @@ discard block |
||
1225 | 1225 | |
1226 | 1226 | // S'il y a une chance de correspondance, alors ce sera |
1227 | 1227 | // soit avec $search au début de la chaîne $to. |
1228 | - if (! str_starts_with($to, $search)) { |
|
1228 | + if (!str_starts_with($to, $search)) { |
|
1229 | 1229 | continue; |
1230 | 1230 | } |
1231 | 1231 | |
@@ -1301,7 +1301,7 @@ discard block |
||
1301 | 1301 | |
1302 | 1302 | // Construisez notre chaîne résultante, en insérant les $params aux endroits appropriés. |
1303 | 1303 | foreach ($matches[0] as $index => $placeholder) { |
1304 | - if (! isset($params[$index])) { |
|
1304 | + if (!isset($params[$index])) { |
|
1305 | 1305 | throw new InvalidArgumentException( |
1306 | 1306 | 'Argument manquant pour "' . $placeholder . '" dans la route "' . $from . '".' |
1307 | 1307 | ); |
@@ -1312,7 +1312,7 @@ discard block |
||
1312 | 1312 | // ou peut-être que $placeholder n'est pas un espace réservé, mais une regex. |
1313 | 1313 | $pattern = $this->placeholders[$placeholderName] ?? $placeholder; |
1314 | 1314 | |
1315 | - if (! preg_match('#^' . $pattern . '$#u', (string) $params[$index])) { |
|
1315 | + if (!preg_match('#^' . $pattern . '$#u', (string) $params[$index])) { |
|
1316 | 1316 | throw RouterException::invalidParameterType(); |
1317 | 1317 | } |
1318 | 1318 | |
@@ -1369,7 +1369,7 @@ discard block |
||
1369 | 1369 | $from = trim($from, '/'); |
1370 | 1370 | } |
1371 | 1371 | |
1372 | - if (is_string($to) && ! str_contains($to, '::') && class_exists($to) && method_exists($to, '__invoke')) { |
|
1372 | + if (is_string($to) && !str_contains($to, '::') && class_exists($to) && method_exists($to, '__invoke')) { |
|
1373 | 1373 | $to = [$to, '__invoke']; |
1374 | 1374 | } |
1375 | 1375 | |
@@ -1381,7 +1381,7 @@ discard block |
||
1381 | 1381 | $options = array_merge($this->currentOptions ?? [], $options ?? []); |
1382 | 1382 | |
1383 | 1383 | if (isset($options['middleware'])) { |
1384 | - if (! isset($options['middlewares'])) { |
|
1384 | + if (!isset($options['middlewares'])) { |
|
1385 | 1385 | $options['middlewares'] = (array) $options['middleware']; |
1386 | 1386 | } |
1387 | 1387 | unset($options['middleware']); |
@@ -1402,9 +1402,9 @@ discard block |
||
1402 | 1402 | } |
1403 | 1403 | |
1404 | 1404 | // Limitation du nom d'hôte ? |
1405 | - if (! empty($options['hostname'])) { |
|
1405 | + if (!empty($options['hostname'])) { |
|
1406 | 1406 | // @todo déterminer s'il existe un moyen de mettre les hôtes sur liste blanche ? |
1407 | - if (! $this->checkHostname($options['hostname'])) { |
|
1407 | + if (!$this->checkHostname($options['hostname'])) { |
|
1408 | 1408 | return; |
1409 | 1409 | } |
1410 | 1410 | |
@@ -1412,10 +1412,10 @@ discard block |
||
1412 | 1412 | } |
1413 | 1413 | |
1414 | 1414 | // Limitation du nom sous-domaine ? |
1415 | - elseif (! empty($options['subdomain'])) { |
|
1415 | + elseif (!empty($options['subdomain'])) { |
|
1416 | 1416 | // Si nous ne correspondons pas au sous-domaine actuel, alors |
1417 | 1417 | // nous n'avons pas besoin d'ajouter la route. |
1418 | - if (! $this->checkSubdomains($options['subdomain'])) { |
|
1418 | + if (!$this->checkSubdomains($options['subdomain'])) { |
|
1419 | 1419 | return; |
1420 | 1420 | } |
1421 | 1421 | |
@@ -1448,9 +1448,9 @@ discard block |
||
1448 | 1448 | } |
1449 | 1449 | |
1450 | 1450 | // S'il s'agit d'une redirection, aucun traitement |
1451 | - if (! isset($options['redirect']) && is_string($to)) { |
|
1451 | + if (!isset($options['redirect']) && is_string($to)) { |
|
1452 | 1452 | // Si aucun espace de noms n'est trouvé, ajouter l'espace de noms par défaut |
1453 | - if (! str_contains($to, '\\') || strpos($to, '\\') > 0) { |
|
1453 | + if (!str_contains($to, '\\') || strpos($to, '\\') > 0) { |
|
1454 | 1454 | $namespace = $options['namespace'] ?? $this->defaultNamespace; |
1455 | 1455 | $to = trim($namespace, '\\') . '\\' . $to; |
1456 | 1456 | } |
@@ -1467,7 +1467,7 @@ discard block |
||
1467 | 1467 | // cela ne fonctionne que parce que les routes découvertes sont ajoutées juste avant |
1468 | 1468 | // pour tenter de router la requête. |
1469 | 1469 | $routeKeyExists = isset($this->routes[$verb][$routeKey]); |
1470 | - if ((isset($this->routesNames[$verb][$name]) || $routeKeyExists) && ! $overwrite) { |
|
1470 | + if ((isset($this->routesNames[$verb][$name]) || $routeKeyExists) && !$overwrite) { |
|
1471 | 1471 | return; |
1472 | 1472 | } |
1473 | 1473 | |
@@ -1493,7 +1493,7 @@ discard block |
||
1493 | 1493 | private function checkHostname(string $hostname): bool |
1494 | 1494 | { |
1495 | 1495 | // Les appels CLI ne peuvent pas être sur le nom d'hôte. |
1496 | - if (! isset($this->httpHost)) { |
|
1496 | + if (!isset($this->httpHost)) { |
|
1497 | 1497 | return false; |
1498 | 1498 | } |
1499 | 1499 | |
@@ -1509,7 +1509,7 @@ discard block |
||
1509 | 1509 | private function checkSubdomains($subdomains): bool |
1510 | 1510 | { |
1511 | 1511 | // Les appels CLI ne peuvent pas être sur le sous-domaine. |
1512 | - if (! isset($this->httpHost)) { |
|
1512 | + if (!isset($this->httpHost)) { |
|
1513 | 1513 | return false; |
1514 | 1514 | } |
1515 | 1515 | |
@@ -1517,13 +1517,13 @@ discard block |
||
1517 | 1517 | $this->currentSubdomain = $this->determineCurrentSubdomain(); |
1518 | 1518 | } |
1519 | 1519 | |
1520 | - if (! is_array($subdomains)) { |
|
1520 | + if (!is_array($subdomains)) { |
|
1521 | 1521 | $subdomains = [$subdomains]; |
1522 | 1522 | } |
1523 | 1523 | |
1524 | 1524 | // Les routes peuvent être limitées à n'importe quel sous-domaine. Dans ce cas, cependant, |
1525 | 1525 | // il nécessite la présence d'un sous-domaine. |
1526 | - if (! empty($this->currentSubdomain) && in_array('*', $subdomains, true)) { |
|
1526 | + if (!empty($this->currentSubdomain) && in_array('*', $subdomains, true)) { |
|
1527 | 1527 | return true; |
1528 | 1528 | } |
1529 | 1529 | |
@@ -1545,7 +1545,7 @@ discard block |
||
1545 | 1545 | // sur l'URL sinon parse_url sera mal interprété |
1546 | 1546 | // 'hôte' comme 'chemin'. |
1547 | 1547 | $url = $this->httpHost; |
1548 | - if (! str_starts_with($url, 'http')) { |
|
1548 | + if (!str_starts_with($url, 'http')) { |
|
1549 | 1549 | $url = 'http://' . $url; |
1550 | 1550 | } |
1551 | 1551 | |
@@ -1586,7 +1586,7 @@ discard block |
||
1586 | 1586 | |
1587 | 1587 | private function getControllerName(Closure|string $handler): ?string |
1588 | 1588 | { |
1589 | - if (! is_string($handler)) { |
|
1589 | + if (!is_string($handler)) { |
|
1590 | 1590 | return null; |
1591 | 1591 | } |
1592 | 1592 | |
@@ -1645,13 +1645,13 @@ discard block |
||
1645 | 1645 | */ |
1646 | 1646 | private function replaceLocale(string $route, ?string $locale = null): string |
1647 | 1647 | { |
1648 | - if (! str_contains($route, '{locale}')) { |
|
1648 | + if (!str_contains($route, '{locale}')) { |
|
1649 | 1649 | return $route; |
1650 | 1650 | } |
1651 | 1651 | |
1652 | 1652 | // Vérifier les paramètres régionaux non valides |
1653 | 1653 | if ($locale !== null) { |
1654 | - if (! in_array($locale, config('app.supported_locales'), true)) { |
|
1654 | + if (!in_array($locale, config('app.supported_locales'), true)) { |
|
1655 | 1655 | $locale = null; |
1656 | 1656 | } |
1657 | 1657 | } |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | $controller = $routes->getDefaultController(); |
176 | 176 | } |
177 | 177 | |
178 | - if (! $fullName && is_string($controller)) { |
|
178 | + if (!$fullName && is_string($controller)) { |
|
179 | 179 | $controller = str_replace($routes->getDefaultNamespace(), '', $controller); |
180 | 180 | } |
181 | 181 | |
@@ -301,14 +301,14 @@ discard block |
||
301 | 301 | return; |
302 | 302 | } |
303 | 303 | |
304 | - if (is_cli() && ! on_test()) { |
|
304 | + if (is_cli() && !on_test()) { |
|
305 | 305 | // @codeCoverageIgnoreStart |
306 | 306 | // $this->request = Services::clirequest($this->config); |
307 | 307 | // @codeCoverageIgnoreEnd |
308 | 308 | } |
309 | 309 | |
310 | 310 | $version = $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.1'; |
311 | - if (! is_numeric($version)) { |
|
311 | + if (!is_numeric($version)) { |
|
312 | 312 | $version = substr($version, strpos($version, '/') + 1); |
313 | 313 | } |
314 | 314 | |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | // Supposons le succès jusqu'à preuve du contraire. |
328 | 328 | $this->response = Services::response()->withStatus(200); |
329 | 329 | |
330 | - if (! is_cli() || on_test()) { |
|
330 | + if (!is_cli() || on_test()) { |
|
331 | 331 | } |
332 | 332 | |
333 | 333 | $this->response = $this->response->withProtocolVersion($this->request->getProtocolVersion()); |
@@ -424,7 +424,7 @@ discard block |
||
424 | 424 | } |
425 | 425 | |
426 | 426 | // Essayez de charger automatiquement la classe |
427 | - if (! class_exists($this->controller, true) || ($this->method[0] === '_' && $this->method !== '__invoke')) { |
|
427 | + if (!class_exists($this->controller, true) || ($this->method[0] === '_' && $this->method !== '__invoke')) { |
|
428 | 428 | throw PageNotFoundException::controllerNotFound($this->controller, $this->method); |
429 | 429 | } |
430 | 430 | |
@@ -513,7 +513,7 @@ discard block |
||
513 | 513 | |
514 | 514 | $this->outputBufferingEnd(); |
515 | 515 | |
516 | - throw PageNotFoundException::pageNotFound(! on_prod() || is_cli() ? $e->getMessage() : ''); |
|
516 | + throw PageNotFoundException::pageNotFound(!on_prod() || is_cli() ? $e->getMessage() : ''); |
|
517 | 517 | } |
518 | 518 | |
519 | 519 | /** |
@@ -555,7 +555,7 @@ discard block |
||
555 | 555 | public function storePreviousURL($uri) |
556 | 556 | { |
557 | 557 | // Ignorer les requêtes CLI |
558 | - if (is_cli() && ! on_test()) { |
|
558 | + if (is_cli() && !on_test()) { |
|
559 | 559 | return; // @codeCoverageIgnore |
560 | 560 | } |
561 | 561 | |
@@ -565,7 +565,7 @@ discard block |
||
565 | 565 | } |
566 | 566 | |
567 | 567 | // Ignorer les reponses non-HTML |
568 | - if (! str_contains($this->response->getHeaderLine('Content-Type'), 'text/html')) { |
|
568 | + if (!str_contains($this->response->getHeaderLine('Content-Type'), 'text/html')) { |
|
569 | 569 | return; |
570 | 570 | } |
571 | 571 | |
@@ -589,7 +589,7 @@ discard block |
||
589 | 589 | */ |
590 | 590 | protected function sendResponse() |
591 | 591 | { |
592 | - if (! ($this->request->expectsJson() || $this->request->isJson() || Text::contains($this->response->getType(), ['/json', '+json']))) { |
|
592 | + if (!($this->request->expectsJson() || $this->request->isJson() || Text::contains($this->response->getType(), ['/json', '+json']))) { |
|
593 | 593 | $this->response = Services::toolbar()->prepare( |
594 | 594 | $this->getPerformanceStats(), |
595 | 595 | $this->request, |
@@ -682,11 +682,11 @@ discard block |
||
682 | 682 | */ |
683 | 683 | private function spoofRequestMethod(): callable |
684 | 684 | { |
685 | - return static function (ServerRequestInterface $request, ResponseInterface $response, callable $next) { |
|
685 | + return static function(ServerRequestInterface $request, ResponseInterface $response, callable $next) { |
|
686 | 686 | $post = $request->getParsedBody(); |
687 | 687 | |
688 | 688 | // Ne fonctionne qu'avec les formulaires POST |
689 | - if ($request->getMethod() === 'POST' && ! empty($post['_method'])) { |
|
689 | + if ($request->getMethod() === 'POST' && !empty($post['_method'])) { |
|
690 | 690 | // Accepte seulement PUT, PATCH, DELETE |
691 | 691 | if (in_array($post['_method'], ['PUT', 'PATCH', 'DELETE'], true)) { |
692 | 692 | $request = $request->withMethod($post['_method']); |
@@ -699,7 +699,7 @@ discard block |
||
699 | 699 | |
700 | 700 | private function bootApp(): callable |
701 | 701 | { |
702 | - return function (ServerRequestInterface $request, ResponseInterface $response, callable $next): ResponseInterface { |
|
702 | + return function(ServerRequestInterface $request, ResponseInterface $response, callable $next): ResponseInterface { |
|
703 | 703 | Services::set(Request::class, $request); |
704 | 704 | Services::set(Response::class, $response); |
705 | 705 | |
@@ -707,10 +707,10 @@ discard block |
||
707 | 707 | $returned = $this->startController(); |
708 | 708 | |
709 | 709 | // Les controleur sous forme de Closure sont executes dans startController(). |
710 | - if (! is_callable($this->controller)) { |
|
710 | + if (!is_callable($this->controller)) { |
|
711 | 711 | $controller = $this->createController($request, $response); |
712 | 712 | |
713 | - if (! method_exists($controller, '_remap') && ! is_callable([$controller, $this->method], false)) { |
|
713 | + if (!method_exists($controller, '_remap') && !is_callable([$controller, $this->method], false)) { |
|
714 | 714 | throw PageNotFoundException::methodNotFound($this->method); |
715 | 715 | } |
716 | 716 |