@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | |
14 | 14 | // Ce helper est automatiquement chargé par BlitzPHP. |
15 | 15 | |
16 | -if (! function_exists('dd')) { |
|
16 | +if (!function_exists('dd')) { |
|
17 | 17 | /** |
18 | 18 | * Imprime un rapport de débogage Kint et coupe le script. |
19 | 19 | * |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | } |
33 | 33 | } |
34 | 34 | |
35 | -if (! function_exists('dump')) { |
|
35 | +if (!function_exists('dump')) { |
|
36 | 36 | /** |
37 | 37 | * Imprime un rapport de débogage Kint sans couper le script. |
38 | 38 | * |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | } |
50 | 50 | } |
51 | 51 | |
52 | -if (! function_exists('d') && ! class_exists(Kint::class)) { |
|
52 | +if (!function_exists('d') && !class_exists(Kint::class)) { |
|
53 | 53 | // Au cas où Kint n'est pas chargé |
54 | 54 | /** |
55 | 55 | * @param array $vars |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | } |
61 | 61 | } |
62 | 62 | |
63 | -if (! function_exists('trace')) { |
|
63 | +if (!function_exists('trace')) { |
|
64 | 64 | /** |
65 | 65 | * Fournit un backtrace au point d'exécution actuel, à partir de Kint. |
66 | 66 | * |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | */ |
71 | 71 | function trace() |
72 | 72 | { |
73 | - if (! class_exists(Kint::class)) { |
|
73 | + if (!class_exists(Kint::class)) { |
|
74 | 74 | return 0; |
75 | 75 | } |
76 | 76 |
@@ -504,7 +504,7 @@ discard block |
||
504 | 504 | |
505 | 505 | protected static function cacheServices(): void |
506 | 506 | { |
507 | - if (! static::$discovered) { |
|
507 | + if (!static::$discovered) { |
|
508 | 508 | $locator = static::locator(); |
509 | 509 | $files = $locator->search('Config/Services'); |
510 | 510 | |
@@ -531,7 +531,7 @@ discard block |
||
531 | 531 | $name = array_shift($arguments); |
532 | 532 | |
533 | 533 | if (empty(static::$instances[$name])) { |
534 | - if (! empty($arguments)) { |
|
534 | + if (!empty($arguments)) { |
|
535 | 535 | static::$instances[$name] = static::factory($name, $arguments); |
536 | 536 | } else { |
537 | 537 | static::$instances[$name] = static::container()->get($name); |
@@ -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 | * |
@@ -100,30 +100,30 @@ discard block |
||
100 | 100 | { |
101 | 101 | $result = (string) $str; |
102 | 102 | |
103 | - if (! is_countable($result)) { |
|
103 | + if (!is_countable($result)) { |
|
104 | 104 | return $result; |
105 | 105 | } |
106 | 106 | |
107 | 107 | $plural_rules = [ |
108 | - '/(quiz)$/' => '\1zes', // quizzes |
|
109 | - '/^(ox)$/' => '\1\2en', // ox |
|
110 | - '/([m|l])ouse$/' => '\1ice', // mouse, louse |
|
111 | - '/(matr|vert|ind)ix|ex$/' => '\1ices', // matrix, vertex, index |
|
112 | - '/(x|ch|ss|sh)$/' => '\1es', // search, switch, fix, box, process, address |
|
113 | - '/([^aeiouy]|qu)y$/' => '\1ies', // query, ability, agency |
|
114 | - '/(hive)$/' => '\1s', // archive, hive |
|
115 | - '/(?:([^f])fe|([lr])f)$/' => '\1\2ves', // half, safe, wife |
|
116 | - '/sis$/' => 'ses', // basis, diagnosis |
|
117 | - '/([ti])um$/' => '\1a', // datum, medium |
|
118 | - '/(p)erson$/' => '\1eople', // person, salesperson |
|
119 | - '/(m)an$/' => '\1en', // man, woman, spokesman |
|
120 | - '/(c)hild$/' => '\1hildren', // child |
|
121 | - '/(buffal|tomat)o$/' => '\1\2oes', // buffalo, tomato |
|
122 | - '/(bu|campu)s$/' => '\1\2ses', // bus, campus |
|
123 | - '/(alias|status|virus)$/' => '\1es', // alias |
|
124 | - '/(octop)us$/' => '\1i', // octopus |
|
125 | - '/(ax|cris|test)is$/' => '\1es', // axis, crisis |
|
126 | - '/s$/' => 's', // no change (compatibility) |
|
108 | + '/(quiz)$/' => '\1zes', // quizzes |
|
109 | + '/^(ox)$/' => '\1\2en', // ox |
|
110 | + '/([m|l])ouse$/' => '\1ice', // mouse, louse |
|
111 | + '/(matr|vert|ind)ix|ex$/' => '\1ices', // matrix, vertex, index |
|
112 | + '/(x|ch|ss|sh)$/' => '\1es', // search, switch, fix, box, process, address |
|
113 | + '/([^aeiouy]|qu)y$/' => '\1ies', // query, ability, agency |
|
114 | + '/(hive)$/' => '\1s', // archive, hive |
|
115 | + '/(?:([^f])fe|([lr])f)$/' => '\1\2ves', // half, safe, wife |
|
116 | + '/sis$/' => 'ses', // basis, diagnosis |
|
117 | + '/([ti])um$/' => '\1a', // datum, medium |
|
118 | + '/(p)erson$/' => '\1eople', // person, salesperson |
|
119 | + '/(m)an$/' => '\1en', // man, woman, spokesman |
|
120 | + '/(c)hild$/' => '\1hildren', // child |
|
121 | + '/(buffal|tomat)o$/' => '\1\2oes', // buffalo, tomato |
|
122 | + '/(bu|campu)s$/' => '\1\2ses', // bus, campus |
|
123 | + '/(alias|status|virus)$/' => '\1es', // alias |
|
124 | + '/(octop)us$/' => '\1i', // octopus |
|
125 | + '/(ax|cris|test)is$/' => '\1es', // axis, crisis |
|
126 | + '/s$/' => 's', // no change (compatibility) |
|
127 | 127 | '/$/' => 's', |
128 | 128 | ]; |
129 | 129 | |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | } |
139 | 139 | } |
140 | 140 | |
141 | -if (! function_exists('pluralize')) { |
|
141 | +if (!function_exists('pluralize')) { |
|
142 | 142 | /** |
143 | 143 | * Return $word in plural form. |
144 | 144 | * |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | } |
153 | 153 | } |
154 | 154 | |
155 | -if (! function_exists('singular')) { |
|
155 | +if (!function_exists('singular')) { |
|
156 | 156 | /** |
157 | 157 | * Singular |
158 | 158 | * |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | { |
167 | 167 | $result = (string) $str; |
168 | 168 | |
169 | - if (! is_countable($result)) { |
|
169 | + if (!is_countable($result)) { |
|
170 | 170 | return $result; |
171 | 171 | } |
172 | 172 | |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | } |
213 | 213 | } |
214 | 214 | |
215 | -if (! function_exists('singularize')) { |
|
215 | +if (!function_exists('singularize')) { |
|
216 | 216 | /** |
217 | 217 | * Return $word in singular form. |
218 | 218 | * |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | } |
227 | 227 | } |
228 | 228 | |
229 | -if (! function_exists('tableize')) { |
|
229 | +if (!function_exists('tableize')) { |
|
230 | 230 | /** |
231 | 231 | * Returns corresponding table name for given model $className. ("people" for the model class "Person"). |
232 | 232 | * |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | } |
241 | 241 | } |
242 | 242 | |
243 | -if (! function_exists('underscore')) { |
|
243 | +if (!function_exists('underscore')) { |
|
244 | 244 | /** |
245 | 245 | * Underscore |
246 | 246 | * |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | } |
255 | 255 | } |
256 | 256 | |
257 | -if (! function_exists('variable')) { |
|
257 | +if (!function_exists('variable')) { |
|
258 | 258 | /** |
259 | 259 | * Returns camelBacked version of an underscored string. |
260 | 260 | * |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | } |
269 | 269 | } |
270 | 270 | |
271 | -if (! function_exists('counted')) { |
|
271 | +if (!function_exists('counted')) { |
|
272 | 272 | /** |
273 | 273 | * Counted |
274 | 274 | * |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | } |
287 | 287 | } |
288 | 288 | |
289 | -if (! function_exists('pascalize')) { |
|
289 | +if (!function_exists('pascalize')) { |
|
290 | 290 | /** |
291 | 291 | * Pascalize |
292 | 292 | * |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | } |
303 | 303 | } |
304 | 304 | |
305 | -if (! function_exists('is_pluralizable')) { |
|
305 | +if (!function_exists('is_pluralizable')) { |
|
306 | 306 | /** |
307 | 307 | * Checks if the given word has a plural version. |
308 | 308 | * |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | */ |
311 | 311 | function is_pluralizable(string $word): bool |
312 | 312 | { |
313 | - return ! in_array( |
|
313 | + return !in_array( |
|
314 | 314 | strtolower($word), |
315 | 315 | [ |
316 | 316 | 'advice', |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | } |
386 | 386 | } |
387 | 387 | |
388 | -if (! function_exists('ordinal')) { |
|
388 | +if (!function_exists('ordinal')) { |
|
389 | 389 | /** |
390 | 390 | * Returns the suffix that should be added to a |
391 | 391 | * number to denote the position in an ordered |
@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | } |
413 | 413 | } |
414 | 414 | |
415 | -if (! function_exists('ordinalize')) { |
|
415 | +if (!function_exists('ordinalize')) { |
|
416 | 416 | /** |
417 | 417 | * Turns a number into an ordinal string used |
418 | 418 | * to denote the position in an ordered sequence |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | </span> |
43 | 43 | |
44 | 44 | <?php foreach ($collectors as $c) : ?> |
45 | - <?php if (! $c['isEmpty'] && ($c['hasTabContent'] || $c['hasLabel'])) : ?> |
|
45 | + <?php if (!$c['isEmpty'] && ($c['hasTabContent'] || $c['hasLabel'])) : ?> |
|
46 | 46 | <span class="blitzphp-label"> |
47 | 47 | <a href="javascript: void(0)" data-tab="blitzphp-<?= $c['key'] ?>"> |
48 | 48 | <img src="<?= $c['icon'] ?>"> |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | |
103 | 103 | <!-- Collector-provided Tabs --> |
104 | 104 | <?php foreach ($collectors as $c) : ?> |
105 | - <?php if (! $c['isEmpty']) : ?> |
|
105 | + <?php if (!$c['isEmpty']) : ?> |
|
106 | 106 | <?php if ($c['hasTabContent']) : ?> |
107 | 107 | <div id="blitzphp-<?= $c['key'] ?>" class="tab"> |
108 | 108 | <h2><?= $c['title'] ?> <span><?= $c['titleDetails'] ?></span></h2> |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | </a> |
150 | 150 | |
151 | 151 | <?php if (isset($vars['session'])) : ?> |
152 | - <?php if (! empty($vars['session'])) : ?> |
|
152 | + <?php if (!empty($vars['session'])) : ?> |
|
153 | 153 | <table id="session_table"> |
154 | 154 | <tbody> |
155 | 155 | <?php foreach ($vars['session'] as $key => $value) : ?> |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | $controller = $routes->getDefaultController(); |
179 | 179 | } |
180 | 180 | |
181 | - if (! $fullName && is_string($controller)) { |
|
181 | + if (!$fullName && is_string($controller)) { |
|
182 | 182 | $controller = str_replace($routes->getDefaultNamespace(), '', $controller); |
183 | 183 | } |
184 | 184 | |
@@ -323,14 +323,14 @@ discard block |
||
323 | 323 | return; |
324 | 324 | } |
325 | 325 | |
326 | - if (is_cli() && ! on_test()) { |
|
326 | + if (is_cli() && !on_test()) { |
|
327 | 327 | // @codeCoverageIgnoreStart |
328 | 328 | // $this->request = Services::clirequest($this->config); |
329 | 329 | // @codeCoverageIgnoreEnd |
330 | 330 | } |
331 | 331 | |
332 | 332 | $version = $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.1'; |
333 | - if (! is_numeric($version)) { |
|
333 | + if (!is_numeric($version)) { |
|
334 | 334 | $version = substr($version, strpos($version, '/') + 1); |
335 | 335 | } |
336 | 336 | |
@@ -349,7 +349,7 @@ discard block |
||
349 | 349 | // Supposons le succès jusqu'à preuve du contraire. |
350 | 350 | $this->response = Services::response()->withStatus(200); |
351 | 351 | |
352 | - if (! is_cli() || on_test()) { |
|
352 | + if (!is_cli() || on_test()) { |
|
353 | 353 | } |
354 | 354 | |
355 | 355 | $this->response = $this->response->withProtocolVersion($this->request->getProtocolVersion()); |
@@ -463,7 +463,7 @@ discard block |
||
463 | 463 | */ |
464 | 464 | protected function determinePath(): string |
465 | 465 | { |
466 | - if (! empty($this->path)) { |
|
466 | + if (!empty($this->path)) { |
|
467 | 467 | return $this->path; |
468 | 468 | } |
469 | 469 | |
@@ -504,7 +504,7 @@ discard block |
||
504 | 504 | } |
505 | 505 | |
506 | 506 | // Essayez de charger automatiquement la classe |
507 | - if (! class_exists($this->controller, true) || ($this->method[0] === '_' && $this->method !== '__invoke')) { |
|
507 | + if (!class_exists($this->controller, true) || ($this->method[0] === '_' && $this->method !== '__invoke')) { |
|
508 | 508 | throw PageNotFoundException::controllerNotFound($this->controller, $this->method); |
509 | 509 | } |
510 | 510 | |
@@ -597,7 +597,7 @@ discard block |
||
597 | 597 | echo $this->outputBufferingEnd(); |
598 | 598 | flush(); |
599 | 599 | |
600 | - throw PageNotFoundException::pageNotFound(! on_prod() || is_cli() ? $e->getMessage() : ''); |
|
600 | + throw PageNotFoundException::pageNotFound(!on_prod() || is_cli() ? $e->getMessage() : ''); |
|
601 | 601 | } |
602 | 602 | |
603 | 603 | /** |
@@ -639,7 +639,7 @@ discard block |
||
639 | 639 | public function storePreviousURL($uri) |
640 | 640 | { |
641 | 641 | // Ignorer les requêtes CLI |
642 | - if (is_cli() && ! on_test()) { |
|
642 | + if (is_cli() && !on_test()) { |
|
643 | 643 | return; // @codeCoverageIgnore |
644 | 644 | } |
645 | 645 | |
@@ -649,7 +649,7 @@ discard block |
||
649 | 649 | } |
650 | 650 | |
651 | 651 | // Ignorer les reponses non-HTML |
652 | - if (! str_contains($this->response->getHeaderLine('Content-Type'), 'text/html')) { |
|
652 | + if (!str_contains($this->response->getHeaderLine('Content-Type'), 'text/html')) { |
|
653 | 653 | return; |
654 | 654 | } |
655 | 655 | |
@@ -761,11 +761,11 @@ discard block |
||
761 | 761 | */ |
762 | 762 | private function spoofRequestMethod(): callable |
763 | 763 | { |
764 | - return static function (ServerRequestInterface $request, ResponseInterface $response, callable $next) { |
|
764 | + return static function(ServerRequestInterface $request, ResponseInterface $response, callable $next) { |
|
765 | 765 | $post = $request->getParsedBody(); |
766 | 766 | |
767 | 767 | // Ne fonctionne qu'avec les formulaires POST |
768 | - if (strtoupper($request->getMethod()) === 'POST' && ! empty($post['_method'])) { |
|
768 | + if (strtoupper($request->getMethod()) === 'POST' && !empty($post['_method'])) { |
|
769 | 769 | // Accepte seulement PUT, PATCH, DELETE |
770 | 770 | if (in_array(strtoupper($post['_method']), ['PUT', 'PATCH', 'DELETE'], true)) { |
771 | 771 | $request = $request->withMethod($post['_method']); |
@@ -778,15 +778,15 @@ discard block |
||
778 | 778 | |
779 | 779 | private function bootApp(): callable |
780 | 780 | { |
781 | - return function (ServerRequestInterface $request, ResponseInterface $response, callable $next): ResponseInterface { |
|
781 | + return function(ServerRequestInterface $request, ResponseInterface $response, callable $next): ResponseInterface { |
|
782 | 782 | try { |
783 | 783 | $returned = $this->startController($request, $response); |
784 | 784 | |
785 | 785 | // Closure controller has run in startController(). |
786 | - if (! is_callable($this->controller)) { |
|
786 | + if (!is_callable($this->controller)) { |
|
787 | 787 | $controller = $this->createController($request, $response); |
788 | 788 | |
789 | - if (! method_exists($controller, '_remap') && ! is_callable([$controller, $this->method], false)) { |
|
789 | + if (!method_exists($controller, '_remap') && !is_callable([$controller, $this->method], false)) { |
|
790 | 790 | throw PageNotFoundException::methodNotFound($this->method); |
791 | 791 | } |
792 | 792 |
@@ -35,7 +35,7 @@ |
||
35 | 35 | */ |
36 | 36 | public function collect(bool $reset = true): array |
37 | 37 | { |
38 | - if (! $reset && $this->cachedRoutes !== []) { |
|
38 | + if (!$reset && $this->cachedRoutes !== []) { |
|
39 | 39 | return $this->cachedRoutes; |
40 | 40 | } |
41 | 41 |
@@ -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 | |
@@ -1013,7 +1013,7 @@ discard block |
||
1013 | 1013 | * |
1014 | 1014 | * @param array|Closure|string $to |
1015 | 1015 | */ |
1016 | - public function match(array $verbs = [], string $from = '', $to = '', ?array $options = null): self |
|
1016 | + public function match(array $verbs = [], string $from = '', $to = '', ?array $options = null) : self |
|
1017 | 1017 | { |
1018 | 1018 | if (empty($from) || empty($to)) { |
1019 | 1019 | throw new InvalidArgumentException('Vous devez fournir les paramètres : $from, $to.'); |
@@ -1199,7 +1199,7 @@ discard block |
||
1199 | 1199 | $from = $route['from']; |
1200 | 1200 | |
1201 | 1201 | // on ignore les closures |
1202 | - if (! is_string($to)) { |
|
1202 | + if (!is_string($to)) { |
|
1203 | 1203 | continue; |
1204 | 1204 | } |
1205 | 1205 | |
@@ -1210,7 +1210,7 @@ discard block |
||
1210 | 1210 | |
1211 | 1211 | // S'il y a une chance de correspondance, alors ce sera |
1212 | 1212 | // soit avec $search au début de la chaîne $to. |
1213 | - if (! str_starts_with($to, $search)) { |
|
1213 | + if (!str_starts_with($to, $search)) { |
|
1214 | 1214 | continue; |
1215 | 1215 | } |
1216 | 1216 | |
@@ -1288,7 +1288,7 @@ discard block |
||
1288 | 1288 | |
1289 | 1289 | // Construisez notre chaîne résultante, en insérant les $params aux endroits appropriés. |
1290 | 1290 | foreach ($matches[0] as $index => $placeholder) { |
1291 | - if (! isset($params[$index])) { |
|
1291 | + if (!isset($params[$index])) { |
|
1292 | 1292 | throw new InvalidArgumentException( |
1293 | 1293 | 'Argument manquant pour "' . $placeholder . '" dans la route "' . $from . '".' |
1294 | 1294 | ); |
@@ -1299,7 +1299,7 @@ discard block |
||
1299 | 1299 | // ou peut-être que $placeholder n'est pas un espace réservé, mais une regex. |
1300 | 1300 | $pattern = $this->placeholders[$placeholderName] ?? $placeholder; |
1301 | 1301 | |
1302 | - if (! preg_match('#^' . $pattern . '$#u', $params[$index])) { |
|
1302 | + if (!preg_match('#^' . $pattern . '$#u', $params[$index])) { |
|
1303 | 1303 | throw RouterException::invalidParameterType(); |
1304 | 1304 | } |
1305 | 1305 | |
@@ -1356,7 +1356,7 @@ discard block |
||
1356 | 1356 | $from = trim($from, '/'); |
1357 | 1357 | } |
1358 | 1358 | |
1359 | - if (is_string($to) && ! str_contains($to, '::') && class_exists($to) && method_exists($to, '__invoke')) { |
|
1359 | + if (is_string($to) && !str_contains($to, '::') && class_exists($to) && method_exists($to, '__invoke')) { |
|
1360 | 1360 | $to = [$to, '__invoke']; |
1361 | 1361 | } |
1362 | 1362 | |
@@ -1382,9 +1382,9 @@ discard block |
||
1382 | 1382 | } |
1383 | 1383 | |
1384 | 1384 | // Limitation du nom d'hôte ? |
1385 | - if (! empty($options['hostname'])) { |
|
1385 | + if (!empty($options['hostname'])) { |
|
1386 | 1386 | // @todo déterminer s'il existe un moyen de mettre les hôtes sur liste blanche ? |
1387 | - if (! $this->checkHostname($options['hostname'])) { |
|
1387 | + if (!$this->checkHostname($options['hostname'])) { |
|
1388 | 1388 | return; |
1389 | 1389 | } |
1390 | 1390 | |
@@ -1392,10 +1392,10 @@ discard block |
||
1392 | 1392 | } |
1393 | 1393 | |
1394 | 1394 | // Limitation du nom sous-domaine ? |
1395 | - elseif (! empty($options['subdomain'])) { |
|
1395 | + elseif (!empty($options['subdomain'])) { |
|
1396 | 1396 | // Si nous ne correspondons pas au sous-domaine actuel, alors |
1397 | 1397 | // nous n'avons pas besoin d'ajouter la route. |
1398 | - if (! $this->checkSubdomains($options['subdomain'])) { |
|
1398 | + if (!$this->checkSubdomains($options['subdomain'])) { |
|
1399 | 1399 | return; |
1400 | 1400 | } |
1401 | 1401 | |
@@ -1428,9 +1428,9 @@ discard block |
||
1428 | 1428 | } |
1429 | 1429 | |
1430 | 1430 | // S'il s'agit d'une redirection, aucun traitement |
1431 | - if (! isset($options['redirect']) && is_string($to)) { |
|
1431 | + if (!isset($options['redirect']) && is_string($to)) { |
|
1432 | 1432 | // Si aucun espace de noms n'est trouvé, ajouter l'espace de noms par défaut |
1433 | - if (! str_contains($to, '\\') || strpos($to, '\\') > 0) { |
|
1433 | + if (!str_contains($to, '\\') || strpos($to, '\\') > 0) { |
|
1434 | 1434 | $namespace = $options['namespace'] ?? $this->defaultNamespace; |
1435 | 1435 | $to = trim($namespace, '\\') . '\\' . $to; |
1436 | 1436 | } |
@@ -1447,7 +1447,7 @@ discard block |
||
1447 | 1447 | // cela ne fonctionne que parce que les routes découvertes sont ajoutées juste avant |
1448 | 1448 | // pour tenter de router la requête. |
1449 | 1449 | $routeKeyExists = isset($this->routes[$verb][$routeKey]); |
1450 | - if ((isset($this->routesNames[$verb][$name]) || $routeKeyExists) && ! $overwrite) { |
|
1450 | + if ((isset($this->routesNames[$verb][$name]) || $routeKeyExists) && !$overwrite) { |
|
1451 | 1451 | return; |
1452 | 1452 | } |
1453 | 1453 | |
@@ -1473,7 +1473,7 @@ discard block |
||
1473 | 1473 | private function checkHostname(string $hostname): bool |
1474 | 1474 | { |
1475 | 1475 | // Les appels CLI ne peuvent pas être sur le nom d'hôte. |
1476 | - if (! isset($this->httpHost) || is_cli()) { |
|
1476 | + if (!isset($this->httpHost) || is_cli()) { |
|
1477 | 1477 | return false; |
1478 | 1478 | } |
1479 | 1479 | |
@@ -1489,7 +1489,7 @@ discard block |
||
1489 | 1489 | private function checkSubdomains($subdomains): bool |
1490 | 1490 | { |
1491 | 1491 | // Les appels CLI ne peuvent pas être sur le sous-domaine. |
1492 | - if (! isset($this->httpHost)) { |
|
1492 | + if (!isset($this->httpHost)) { |
|
1493 | 1493 | return false; |
1494 | 1494 | } |
1495 | 1495 | |
@@ -1497,13 +1497,13 @@ discard block |
||
1497 | 1497 | $this->currentSubdomain = $this->determineCurrentSubdomain(); |
1498 | 1498 | } |
1499 | 1499 | |
1500 | - if (! is_array($subdomains)) { |
|
1500 | + if (!is_array($subdomains)) { |
|
1501 | 1501 | $subdomains = [$subdomains]; |
1502 | 1502 | } |
1503 | 1503 | |
1504 | 1504 | // Les routes peuvent être limitées à n'importe quel sous-domaine. Dans ce cas, cependant, |
1505 | 1505 | // il nécessite la présence d'un sous-domaine. |
1506 | - if (! empty($this->currentSubdomain) && in_array('*', $subdomains, true)) { |
|
1506 | + if (!empty($this->currentSubdomain) && in_array('*', $subdomains, true)) { |
|
1507 | 1507 | return true; |
1508 | 1508 | } |
1509 | 1509 | |
@@ -1525,7 +1525,7 @@ discard block |
||
1525 | 1525 | // sur l'URL sinon parse_url sera mal interprété |
1526 | 1526 | // 'hôte' comme 'chemin'. |
1527 | 1527 | $url = $this->httpHost; |
1528 | - if (! str_starts_with($url, 'http')) { |
|
1528 | + if (!str_starts_with($url, 'http')) { |
|
1529 | 1529 | $url = 'http://' . $url; |
1530 | 1530 | } |
1531 | 1531 | |
@@ -1566,7 +1566,7 @@ discard block |
||
1566 | 1566 | |
1567 | 1567 | private function getControllerName(Closure|string $handler): ?string |
1568 | 1568 | { |
1569 | - if (! is_string($handler)) { |
|
1569 | + if (!is_string($handler)) { |
|
1570 | 1570 | return null; |
1571 | 1571 | } |
1572 | 1572 | |
@@ -1625,13 +1625,13 @@ discard block |
||
1625 | 1625 | */ |
1626 | 1626 | private function replaceLocale(string $route, ?string $locale = null): string |
1627 | 1627 | { |
1628 | - if (! str_contains($route, '{locale}')) { |
|
1628 | + if (!str_contains($route, '{locale}')) { |
|
1629 | 1629 | return $route; |
1630 | 1630 | } |
1631 | 1631 | |
1632 | 1632 | // Vérifier les paramètres régionaux non valides |
1633 | 1633 | if ($locale !== null) { |
1634 | - if (! in_array($locale, config('app.supported_locales'), true)) { |
|
1634 | + if (!in_array($locale, config('app.supported_locales'), true)) { |
|
1635 | 1635 | $locale = null; |
1636 | 1636 | } |
1637 | 1637 | } |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | { |
71 | 71 | helper('assets'); |
72 | 72 | |
73 | - if (! empty($viewPathLocator)) { |
|
73 | + if (!empty($viewPathLocator)) { |
|
74 | 74 | if (is_string($viewPathLocator)) { |
75 | 75 | $this->viewPath = rtrim($viewPathLocator, '\\/ ') . DS; |
76 | 76 | } elseif ($viewPathLocator instanceof Locator) { |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | $options = (array) $options; |
236 | 236 | |
237 | 237 | $viewPath = $options['viewPath'] ?? $this->viewPath; |
238 | - if (! empty($viewPath)) { |
|
238 | + if (!empty($viewPath)) { |
|
239 | 239 | $file = str_replace('/', DS, rtrim($viewPath, '/\\') . DS . ltrim($view, '/\\')); |
240 | 240 | } else { |
241 | 241 | $file = $view; |
@@ -243,14 +243,14 @@ discard block |
||
243 | 243 | |
244 | 244 | $file = Helpers::ensureExt($file, $ext); |
245 | 245 | |
246 | - if (! is_file($file) && $this->locator instanceof Locator) { |
|
246 | + if (!is_file($file) && $this->locator instanceof Locator) { |
|
247 | 247 | $file = $this->locator->locateFile($view, 'Views', empty($ext) ? 'php' : $ext); |
248 | 248 | } |
249 | 249 | |
250 | 250 | $file = realpath($file); |
251 | 251 | |
252 | 252 | // locateFile renverra une chaîne vide si le fichier est introuvable. |
253 | - if (! is_file($file)) { |
|
253 | + if (!is_file($file)) { |
|
254 | 254 | throw ViewException::invalidFile($view); |
255 | 255 | } |
256 | 256 |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * the LICENSE file that was distributed with this source code. |
10 | 10 | */ |
11 | 11 | |
12 | -if (! function_exists('css_url')) { |
|
12 | +if (!function_exists('css_url')) { |
|
13 | 13 | /** |
14 | 14 | * CSS URL |
15 | 15 | * |
@@ -23,17 +23,17 @@ discard block |
||
23 | 23 | $name = str_replace(site_url() . 'css/', '', htmlspecialchars($name)); |
24 | 24 | |
25 | 25 | if (is_localfile($name)) { |
26 | - $name .= (! preg_match('#\.css$#i', $name) ? '.css' : ''); |
|
26 | + $name .= (!preg_match('#\.css$#i', $name) ? '.css' : ''); |
|
27 | 27 | $filename = WEBROOT . 'css' . DS . $name; |
28 | 28 | |
29 | 29 | return site_url() . 'css/' . $name . ((file_exists($filename)) ? '?v=' . filemtime($filename) : ''); |
30 | 30 | } |
31 | 31 | |
32 | - return $name . (! preg_match('#\.css$#i', $name) ? '.css' : ''); |
|
32 | + return $name . (!preg_match('#\.css$#i', $name) ? '.css' : ''); |
|
33 | 33 | } |
34 | 34 | } |
35 | 35 | |
36 | -if (! function_exists('js_url')) { |
|
36 | +if (!function_exists('js_url')) { |
|
37 | 37 | /** |
38 | 38 | * JS URL |
39 | 39 | * |
@@ -47,17 +47,17 @@ discard block |
||
47 | 47 | $name = str_replace(site_url() . 'js/', '', htmlspecialchars($name)); |
48 | 48 | |
49 | 49 | if (is_localfile($name)) { |
50 | - $name .= (! preg_match('#\.js$#i', $name) ? '.js' : ''); |
|
50 | + $name .= (!preg_match('#\.js$#i', $name) ? '.js' : ''); |
|
51 | 51 | $filename = WEBROOT . 'js' . DS . $name; |
52 | 52 | |
53 | 53 | return site_url() . 'js/' . $name . ((file_exists($filename)) ? '?v=' . filemtime($filename) : ''); |
54 | 54 | } |
55 | 55 | |
56 | - return $name . (! preg_match('#\.js$#i', $name) ? '.js' : ''); |
|
56 | + return $name . (!preg_match('#\.js$#i', $name) ? '.js' : ''); |
|
57 | 57 | } |
58 | 58 | } |
59 | 59 | |
60 | -if (! function_exists('lib_css_url')) { |
|
60 | +if (!function_exists('lib_css_url')) { |
|
61 | 61 | /** |
62 | 62 | * LIB CSS URL |
63 | 63 | * |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | ); |
77 | 77 | |
78 | 78 | if (is_localfile($name)) { |
79 | - $name .= (! preg_match('#\.css$#i', $name) ? '.css' : ''); |
|
79 | + $name .= (!preg_match('#\.css$#i', $name) ? '.css' : ''); |
|
80 | 80 | $paths = ['lib', 'vendor', 'plugins']; |
81 | 81 | |
82 | 82 | foreach ($paths as $path) { |
@@ -90,11 +90,11 @@ discard block |
||
90 | 90 | return $site_url . 'lib/' . $name; |
91 | 91 | } |
92 | 92 | |
93 | - return $name . (! preg_match('#\.css$#i', $name) ? '.css' : ''); |
|
93 | + return $name . (!preg_match('#\.css$#i', $name) ? '.css' : ''); |
|
94 | 94 | } |
95 | 95 | } |
96 | 96 | |
97 | -if (! function_exists('lib_js_url')) { |
|
97 | +if (!function_exists('lib_js_url')) { |
|
98 | 98 | /** |
99 | 99 | * LIB JS URL |
100 | 100 | * |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | ); |
114 | 114 | |
115 | 115 | if (is_localfile($name)) { |
116 | - $name .= (! preg_match('#\.js$#i', $name) ? '.js' : ''); |
|
116 | + $name .= (!preg_match('#\.js$#i', $name) ? '.js' : ''); |
|
117 | 117 | $paths = ['lib', 'vendor', 'plugins']; |
118 | 118 | |
119 | 119 | foreach ($paths as $path) { |
@@ -127,11 +127,11 @@ discard block |
||
127 | 127 | return $site_url . 'lib/' . $name; |
128 | 128 | } |
129 | 129 | |
130 | - return $name . (! preg_match('#\.js$#i', $name) ? '.js' : ''); |
|
130 | + return $name . (!preg_match('#\.js$#i', $name) ? '.js' : ''); |
|
131 | 131 | } |
132 | 132 | } |
133 | 133 | |
134 | -if (! function_exists('lib_styles')) { |
|
134 | +if (!function_exists('lib_styles')) { |
|
135 | 135 | /** |
136 | 136 | * LIB_STYLES |
137 | 137 | * |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | |
150 | 150 | foreach ($name as $style) { |
151 | 151 | if (is_string($style)) { |
152 | - $style = (! preg_match('#\.css$#i', $style) ? $style . '.css' : $style); |
|
152 | + $style = (!preg_match('#\.css$#i', $style) ? $style . '.css' : $style); |
|
153 | 153 | if (is_file(WEBROOT . 'lib' . DS . str_replace('/', DS, $style))) { |
154 | 154 | $return[] = '<link rel="preload" type="text/css" href="' . lib_css_url($style) . '" as="style"> |
155 | 155 | <link rel="stylesheet" type="text/css" href="' . lib_css_url($style) . '" />'; |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | } |
174 | 174 | } |
175 | 175 | |
176 | -if (! function_exists('lib_scripts')) { |
|
176 | +if (!function_exists('lib_scripts')) { |
|
177 | 177 | /** |
178 | 178 | * LIB_SCRIPTS |
179 | 179 | * |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | |
192 | 192 | foreach ($name as $script) { |
193 | 193 | if (is_string($script)) { |
194 | - $script = (! preg_match('#\.js$#i', $script) ? $script . '.js' : $script); |
|
194 | + $script = (!preg_match('#\.js$#i', $script) ? $script . '.js' : $script); |
|
195 | 195 | if (is_file(WEBROOT . 'lib' . DS . str_replace('/', DS, $script))) { |
196 | 196 | $return[] = '<script type="text/javascript" src="' . lib_js_url($script) . '"></script>'; |
197 | 197 | } elseif (is_localfile($script)) { |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | } |
214 | 214 | } |
215 | 215 | |
216 | -if (! function_exists('styles')) { |
|
216 | +if (!function_exists('styles')) { |
|
217 | 217 | /** |
218 | 218 | * STYLES |
219 | 219 | * |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | |
232 | 232 | foreach ($name as $style) { |
233 | 233 | if (is_string($style)) { |
234 | - $style = (! preg_match('#\.css$#i', $style) ? $style . '.css' : $style); |
|
234 | + $style = (!preg_match('#\.css$#i', $style) ? $style . '.css' : $style); |
|
235 | 235 | if (is_file(WEBROOT . 'css' . DS . str_replace('/', DS, $style))) { |
236 | 236 | $return[] = '<link rel="preload" type="text/css" href="' . css_url($style) . '" as="style"> |
237 | 237 | <link rel="stylesheet" type="text/css" href="' . css_url($style) . '" />'; |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | } |
256 | 256 | } |
257 | 257 | |
258 | -if (! function_exists('scripts')) { |
|
258 | +if (!function_exists('scripts')) { |
|
259 | 259 | /** |
260 | 260 | * SCRIPTS |
261 | 261 | * |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | |
274 | 274 | foreach ($name as $script) { |
275 | 275 | if (is_string($script)) { |
276 | - $script = (! preg_match('#\.js$#i', $script) ? $script . '.js' : $script); |
|
276 | + $script = (!preg_match('#\.js$#i', $script) ? $script . '.js' : $script); |
|
277 | 277 | if (is_file(WEBROOT . 'js' . DS . str_replace('/', DS, $script))) { |
278 | 278 | $return[] = '<script type="text/javascript" src="' . js_url($script) . '"></script>'; |
279 | 279 | } elseif (is_localfile($script)) { |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | } |
296 | 296 | } |
297 | 297 | |
298 | -if (! function_exists('less_url')) { |
|
298 | +if (!function_exists('less_url')) { |
|
299 | 299 | /** |
300 | 300 | * LESS URL |
301 | 301 | * |
@@ -309,17 +309,17 @@ discard block |
||
309 | 309 | $name = str_replace(site_url() . 'less/', '', htmlspecialchars($name)); |
310 | 310 | |
311 | 311 | if (is_localfile($name)) { |
312 | - $name .= (! preg_match('#\.less$#i', $name) ? '.less' : ''); |
|
312 | + $name .= (!preg_match('#\.less$#i', $name) ? '.less' : ''); |
|
313 | 313 | $filename = WEBROOT . 'less' . DS . $name; |
314 | 314 | |
315 | 315 | return site_url() . 'less/' . $name . ((file_exists($filename)) ? '?v=' . filemtime($filename) : ''); |
316 | 316 | } |
317 | 317 | |
318 | - return $name . (! preg_match('#\.less$#i', $name) ? '.less' : ''); |
|
318 | + return $name . (!preg_match('#\.less$#i', $name) ? '.less' : ''); |
|
319 | 319 | } |
320 | 320 | } |
321 | 321 | |
322 | -if (! function_exists('less_styles')) { |
|
322 | +if (!function_exists('less_styles')) { |
|
323 | 323 | /** |
324 | 324 | * LESS_STYLES |
325 | 325 | * |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | |
338 | 338 | foreach ($name as $style) { |
339 | 339 | if (is_string($style)) { |
340 | - $style = (! preg_match('#\.less$#i', $style) ? $style . '.less' : $style); |
|
340 | + $style = (!preg_match('#\.less$#i', $style) ? $style . '.less' : $style); |
|
341 | 341 | if (is_file(WEBROOT . 'less' . DS . str_replace('/', DS, $style))) { |
342 | 342 | $return[] = '<link rel="stylesheet" type="text/less" href="' . less_url($style) . '" />'; |
343 | 343 | } elseif (is_localfile($style)) { |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | } |
360 | 360 | } |
361 | 361 | |
362 | -if (! function_exists('img_url')) { |
|
362 | +if (!function_exists('img_url')) { |
|
363 | 363 | /** |
364 | 364 | * IMG URL |
365 | 365 | * |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | } |
387 | 387 | } |
388 | 388 | |
389 | -if (! function_exists('img')) { |
|
389 | +if (!function_exists('img')) { |
|
390 | 390 | /** |
391 | 391 | * IMG |
392 | 392 | * |
@@ -417,7 +417,7 @@ discard block |
||
417 | 417 | } |
418 | 418 | } |
419 | 419 | |
420 | -if (! function_exists('docs_url')) { |
|
420 | +if (!function_exists('docs_url')) { |
|
421 | 421 | /** |
422 | 422 | * DOCS URL |
423 | 423 | * |
@@ -444,7 +444,7 @@ discard block |
||
444 | 444 | } |
445 | 445 | } |
446 | 446 | |
447 | -if (! function_exists('videos_url')) { |
|
447 | +if (!function_exists('videos_url')) { |
|
448 | 448 | /** |
449 | 449 | * VIDEOS URL |
450 | 450 | * |
@@ -471,7 +471,7 @@ discard block |
||
471 | 471 | } |
472 | 472 | } |
473 | 473 | |
474 | -if (! function_exists('mix')) { |
|
474 | +if (!function_exists('mix')) { |
|
475 | 475 | /** |
476 | 476 | * Obtenez le chemin d'accès à un fichier Mix versionné. |
477 | 477 | * |
@@ -496,7 +496,7 @@ discard block |
||
496 | 496 | if (is_file($publicPath . $manifestDirectory . '/hot')) { |
497 | 497 | $url = rtrim(file_get_contents($publicPath . $manifestDirectory . '/hot')); |
498 | 498 | |
499 | - if (! empty($customUrl = $customUrl = $config->hot_proxy_url)) { |
|
499 | + if (!empty($customUrl = $customUrl = $config->hot_proxy_url)) { |
|
500 | 500 | return $customUrl . $path; |
501 | 501 | } |
502 | 502 | |
@@ -509,8 +509,8 @@ discard block |
||
509 | 509 | |
510 | 510 | $manifestPath = $publicPath . $manifestDirectory . '/mix-manifest.json'; |
511 | 511 | |
512 | - if (! isset($manifests[$manifestPath])) { |
|
513 | - if (! is_file($manifestPath)) { |
|
512 | + if (!isset($manifests[$manifestPath])) { |
|
513 | + if (!is_file($manifestPath)) { |
|
514 | 514 | throw new Exception('Le manifeste Mix n\'existe pas.'); |
515 | 515 | } |
516 | 516 | |
@@ -519,10 +519,10 @@ discard block |
||
519 | 519 | |
520 | 520 | $manifest = $manifests[$manifestPath]; |
521 | 521 | |
522 | - if (! isset($manifest[$path])) { |
|
522 | + if (!isset($manifest[$path])) { |
|
523 | 523 | $exception = new Exception("Impossible de localiser le fichier Mix: {$path}."); |
524 | 524 | |
525 | - if (! BLITZ_DEBUG) { |
|
525 | + if (!BLITZ_DEBUG) { |
|
526 | 526 | return $path; |
527 | 527 | } |
528 | 528 |