@@ -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(); |
@@ -6,7 +6,7 @@ |
||
6 | 6 | |
7 | 7 | class {class} extends {extends} |
8 | 8 | { |
9 | -<?php if (! empty($invokable)): ?> |
|
9 | +<?php if (!empty($invokable)): ?> |
|
10 | 10 | /** |
11 | 11 | * Traitement |
12 | 12 | * |
@@ -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 |
@@ -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))); |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | */ |
167 | 167 | public function download(SplFileInfo|string $file, ?string $name = null, array $headers = []): static |
168 | 168 | { |
169 | - if (is_string($file) && ! is_file($file)) { |
|
169 | + if (is_string($file) && !is_file($file)) { |
|
170 | 170 | throw new LoadException('The requested file was not found'); |
171 | 171 | } |
172 | 172 | |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | */ |
179 | 179 | public function streamDownload(callable|StreamInterface|string $stream, string $name, array $headers = []): static |
180 | 180 | { |
181 | - if (! ($stream instanceof StreamInterface)) { |
|
181 | + if (!($stream instanceof StreamInterface)) { |
|
182 | 182 | $stream = to_stream($stream); |
183 | 183 | } |
184 | 184 |
@@ -21,7 +21,7 @@ |
||
21 | 21 | protected function decorate(string $output): string |
22 | 22 | { |
23 | 23 | foreach (config('view.decorators') as $decorator) { |
24 | - if (! is_subclass_of($decorator, ViewDecoratorInterface::class, true)) { |
|
24 | + if (!is_subclass_of($decorator, ViewDecoratorInterface::class, true)) { |
|
25 | 25 | throw ViewException::invalidDecorator($decorator); |
26 | 26 | } |
27 | 27 |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | |
216 | 216 | $data = array_merge(self::$shared, $data); |
217 | 217 | |
218 | - if (! on_test() && ! isset($data['errors'])) { |
|
218 | + if (!on_test() && !isset($data['errors'])) { |
|
219 | 219 | $data['errors'] = $this->setValidationErrors(); |
220 | 220 | } |
221 | 221 | |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | if (is_string($errors)) { |
247 | 247 | $errors = ['default' => $errors]; |
248 | 248 | } |
249 | - if (! ($errors instanceof ErrorBag)) { |
|
249 | + if (!($errors instanceof ErrorBag)) { |
|
250 | 250 | $errors = new ErrorBag($errors); |
251 | 251 | } |
252 | 252 | |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | |
285 | 285 | $data = array_merge(self::$shared, $data); |
286 | 286 | |
287 | - if (! on_test() && ! isset($data['errors'])) { |
|
287 | + if (!on_test() && !isset($data['errors'])) { |
|
288 | 288 | $data['errors'] = $this->setValidationErrors(); |
289 | 289 | } |
290 | 290 | |
@@ -342,10 +342,10 @@ discard block |
||
342 | 342 | */ |
343 | 343 | public function setAdapter(string $adapter, array $config = []): static |
344 | 344 | { |
345 | - if (! array_key_exists($adapter, self::$validAdapters)) { |
|
345 | + if (!array_key_exists($adapter, self::$validAdapters)) { |
|
346 | 346 | $adapter = 'native'; |
347 | 347 | } |
348 | - if (empty($this->config['adapters']) || ! is_array($this->config['adapters'])) { |
|
348 | + if (empty($this->config['adapters']) || !is_array($this->config['adapters'])) { |
|
349 | 349 | $this->config['adapters'] = []; |
350 | 350 | } |
351 | 351 |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | |
271 | 271 | $route = $this->routes->reverseRoute($action, ...$parameters); |
272 | 272 | |
273 | - if (! $route) { |
|
273 | + if (!$route) { |
|
274 | 274 | throw RouterException::actionNotDefined($action); |
275 | 275 | } |
276 | 276 | |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | */ |
342 | 342 | public function isValidUrl(string $path): bool |
343 | 343 | { |
344 | - if (! preg_match('~^(#|//|https?://|(mailto|tel|sms):)~', $path)) { |
|
344 | + if (!preg_match('~^(#|//|https?://|(mailto|tel|sms):)~', $path)) { |
|
345 | 345 | return filter_var($path, FILTER_VALIDATE_URL) !== false; |
346 | 346 | } |
347 | 347 |