@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | /** @var LocatorInterface */ |
39 | 39 | $loader = service('locator'); |
40 | 40 | |
41 | - if (! is_array($filenames)) { |
|
41 | + if (!is_array($filenames)) { |
|
42 | 42 | $filenames = [$filenames]; |
43 | 43 | } |
44 | 44 | |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | } |
83 | 83 | |
84 | 84 | // Les helpers au niveau de l'application doivent remplacer tous les autres |
85 | - if (! empty($appHelper)) { |
|
85 | + if (!empty($appHelper)) { |
|
86 | 86 | $includes[] = $appHelper; |
87 | 87 | $loaded[] = $filename; |
88 | 88 | } |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | $includes = [...$includes, ...$localIncludes]; |
92 | 92 | |
93 | 93 | // Et celui par défaut du système doit être ajouté en dernier. |
94 | - if (! empty($systemHelper)) { |
|
94 | + if (!empty($systemHelper)) { |
|
95 | 95 | $includes[] = $systemHelper; |
96 | 96 | $loaded[] = $filename; |
97 | 97 | } |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | |
130 | 130 | // Si le fichier est dans un espace de noms, nous allons simplement saisir ce fichier et ne pas en rechercher d'autres |
131 | 131 | if (str_contains($name, '\\')) { |
132 | - if (! empty($path = $loader->locateFile($name, 'schemas'))) { |
|
132 | + if (!empty($path = $loader->locateFile($name, 'schemas'))) { |
|
133 | 133 | $file = $path; |
134 | 134 | } |
135 | 135 | } else { |
@@ -147,18 +147,18 @@ discard block |
||
147 | 147 | } |
148 | 148 | |
149 | 149 | // Les schema des vendor sont prioritaire, ensuite vienne ceux de l'application |
150 | - if (! empty($vendorSchema)) { |
|
150 | + if (!empty($vendorSchema)) { |
|
151 | 151 | $file = $vendorSchema; |
152 | - } elseif (! empty($appSchema)) { |
|
152 | + } elseif (!empty($appSchema)) { |
|
153 | 153 | $file = $appSchema; |
154 | - } elseif (! empty($systemSchema)) { |
|
154 | + } elseif (!empty($systemSchema)) { |
|
155 | 155 | $file = $systemSchema; |
156 | 156 | } |
157 | 157 | } |
158 | 158 | |
159 | - $schema = ! empty($file) ? require $file : null; |
|
159 | + $schema = !empty($file) ? require $file : null; |
|
160 | 160 | |
161 | - if (empty($schema) || ! ($schema instanceof Schema)) { |
|
161 | + if (empty($schema) || !($schema instanceof Schema)) { |
|
162 | 162 | $schema = Expect::mixed(); |
163 | 163 | } |
164 | 164 | |
@@ -176,16 +176,16 @@ discard block |
||
176 | 176 | */ |
177 | 177 | public static function model(string $model, ?ConnectionInterface $connection = null) |
178 | 178 | { |
179 | - if (! class_exists($model) && ! Text::endsWith($model, 'Model')) { |
|
179 | + if (!class_exists($model) && !Text::endsWith($model, 'Model')) { |
|
180 | 180 | $model .= 'Model'; |
181 | 181 | } |
182 | 182 | |
183 | - if (! class_exists($model)) { |
|
183 | + if (!class_exists($model)) { |
|
184 | 184 | $model = str_replace(APP_NAMESPACE . '\\Models\\', '', $model); |
185 | 185 | $model = APP_NAMESPACE . '\\Models\\' . $model; |
186 | 186 | } |
187 | 187 | |
188 | - if (! class_exists($model)) { |
|
188 | + if (!class_exists($model)) { |
|
189 | 189 | throw LoadException::modelNotFound($model); |
190 | 190 | } |
191 | 191 | |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | protected static function verifyPreferApp(array $options, string $name): bool |
215 | 215 | { |
216 | 216 | // Tout element sans restriction passe |
217 | - if (! $options['preferApp']) { |
|
217 | + if (!$options['preferApp']) { |
|
218 | 218 | return true; |
219 | 219 | } |
220 | 220 |
@@ -28,7 +28,7 @@ |
||
28 | 28 | $callback = service('request')->getQuery('callback'); |
29 | 29 | |
30 | 30 | if (empty($callback)) { |
31 | - return json_encode($data, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); |
|
31 | + return json_encode($data, JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | // Nous n'honorons qu'un rappel jsonp qui sont des identifiants javascript valides |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | */ |
131 | 131 | public function addIf(string $key, Closure $callback): void |
132 | 132 | { |
133 | - if (! $this->has($key)) { |
|
133 | + if (!$this->has($key)) { |
|
134 | 134 | $this->add($key, $callback); |
135 | 135 | } |
136 | 136 | } |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | */ |
257 | 257 | private function discoveProviders(): void |
258 | 258 | { |
259 | - if (! self::$discovered) { |
|
259 | + if (!self::$discovered) { |
|
260 | 260 | $locator = service('locator'); |
261 | 261 | $files = array_merge( |
262 | 262 | $locator->search('Config/Providers'), |
@@ -34,8 +34,8 @@ discard block |
||
34 | 34 | */ |
35 | 35 | public static function registerHttpErrors(Run $debugger, array $config): Run |
36 | 36 | { |
37 | - return $debugger->pushHandler(static function (Throwable $exception, InspectorInterface $inspector, RunInterface $run) use ($config): int { |
|
38 | - if (true === $config['log'] && ! in_array($exception->getCode(), $config['ignore_codes'], true)) { |
|
37 | + return $debugger->pushHandler(static function(Throwable $exception, InspectorInterface $inspector, RunInterface $run) use ($config): int { |
|
38 | + if (true === $config['log'] && !in_array($exception->getCode(), $config['ignore_codes'], true)) { |
|
39 | 39 | service('logger')->error($exception); |
40 | 40 | } |
41 | 41 | |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | $debugger->pushHandler(new PlainTextHandler()); |
96 | 96 | } |
97 | 97 | |
98 | - if (! is_online()) { |
|
98 | + if (!is_online()) { |
|
99 | 99 | if (Misc::isAjaxRequest() || service('request')->isJson()) { |
100 | 100 | $debugger->pushHandler(new JsonResponseHandler()); |
101 | 101 | } else { |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | public function __construct(bool $debug = false) |
32 | 32 | { |
33 | 33 | $this->mailer = new Mailer(); |
34 | - $this->mailer->Debugoutput = static function ($str, $level): void { |
|
34 | + $this->mailer->Debugoutput = static function($str, $level): void { |
|
35 | 35 | service('logger')->info('[Mail][' . $level . ']: ' . $str); |
36 | 36 | }; |
37 | 37 | |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function init(array $config): static |
45 | 45 | { |
46 | - if (! empty($config['username']) && ! empty($config['password'])) { |
|
46 | + if (!empty($config['username']) && !empty($config['password'])) { |
|
47 | 47 | $this->mailer->SMTPAuth = true; |
48 | 48 | } |
49 | 49 |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | $instance->initialize(service('request'), service('response'), service('logger')); |
79 | 79 | } |
80 | 80 | |
81 | - if (! method_exists($instance, $method)) { |
|
81 | + if (!method_exists($instance, $method)) { |
|
82 | 82 | throw ViewException::invalidComponentMethod($class, $method); |
83 | 83 | } |
84 | 84 | |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | */ |
104 | 104 | public function prepareParams($params): array |
105 | 105 | { |
106 | - if ($params === null || $params === '' || $params === [] || (! is_string($params) && ! is_array($params))) { |
|
106 | + if ($params === null || $params === '' || $params === [] || (!is_string($params) && !is_array($params))) { |
|
107 | 107 | return []; |
108 | 108 | } |
109 | 109 | |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | $library = str_replace('::', ':', $library); |
147 | 147 | |
148 | 148 | // Les composants contrôlées peuvent être appelées avec le seul nom de la classe, c'est pourquoi il faut ajouter une méthode par défaut |
149 | - if (! str_contains($library, ':')) { |
|
149 | + if (!str_contains($library, ':')) { |
|
150 | 150 | $library .= ':render'; |
151 | 151 | } |
152 | 152 | |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | } |
177 | 177 | } |
178 | 178 | |
179 | - if (! is_object($object)) { |
|
179 | + if (!is_object($object)) { |
|
180 | 180 | throw ViewException::invalidComponentClass($class); |
181 | 181 | } |
182 | 182 | |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | |
272 | 272 | $output = $instance->{$method}(); |
273 | 273 | } elseif (($paramCount === 1) |
274 | - && ((! array_key_exists($refParams[0]->name, $params)) |
|
274 | + && ((!array_key_exists($refParams[0]->name, $params)) |
|
275 | 275 | || (array_key_exists($refParams[0]->name, $params) |
276 | 276 | && count($params) !== 1)) |
277 | 277 | ) { |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | } |
289 | 289 | |
290 | 290 | foreach (array_keys($params) as $key) { |
291 | - if (! isset($methodParams[$key])) { |
|
291 | + if (!isset($methodParams[$key])) { |
|
292 | 292 | throw ViewException::invalidComponentParameter($key); |
293 | 293 | } |
294 | 294 | } |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | |
97 | 97 | $file = $this->viewPath . $view; |
98 | 98 | |
99 | - if (! is_file($file)) { |
|
99 | + if (!is_file($file)) { |
|
100 | 100 | $fileOrig = $file; |
101 | 101 | $file = ($this->locator ?: service('locator'))->locateFile($view, 'Views'); |
102 | 102 | |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | foreach ($matches as $match) { |
300 | 300 | // Loop over each piece of $data, replacing |
301 | 301 | // its contents so that we know what to replace in parse() |
302 | - $str = ''; // holds the new contents for this tag pair. |
|
302 | + $str = ''; // holds the new contents for this tag pair. |
|
303 | 303 | |
304 | 304 | foreach ($data as $row) { |
305 | 305 | // Objects that have a `toArray()` method should be |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | |
342 | 342 | // Now replace our placeholders with the new content. |
343 | 343 | foreach ($temp as $pattern => $content) { |
344 | - $out = $this->replaceSingle($pattern, $content, $out, ! isset($pairs[$pattern])); |
|
344 | + $out = $this->replaceSingle($pattern, $content, $out, !isset($pairs[$pattern])); |
|
345 | 345 | } |
346 | 346 | |
347 | 347 | $str .= $out; |
@@ -499,7 +499,7 @@ discard block |
||
499 | 499 | protected function replaceSingle(array|string $pattern, string $content, string $template, bool $escape = false): string |
500 | 500 | { |
501 | 501 | // Replace the content in the template |
502 | - return preg_replace_callback($pattern, function ($matches) use ($content, $escape): string { |
|
502 | + return preg_replace_callback($pattern, function($matches) use ($content, $escape): string { |
|
503 | 503 | // Check for {! !} syntax to not escape this one. |
504 | 504 | if ( |
505 | 505 | str_starts_with($matches[0], $this->leftDelimiter . '!') |
@@ -521,7 +521,7 @@ discard block |
||
521 | 521 | |
522 | 522 | // Our regex earlier will leave all chained values on a single line |
523 | 523 | // so we need to break them apart so we can apply them all. |
524 | - $filters = ! empty($matches[1]) ? explode('|', $matches[1]) : []; |
|
524 | + $filters = !empty($matches[1]) ? explode('|', $matches[1]) : []; |
|
525 | 525 | |
526 | 526 | if ($escape && $filters === [] && ($context = $this->shouldAddEscaping($orig))) { |
527 | 527 | $filters[] = "esc({$context})"; |
@@ -549,7 +549,7 @@ discard block |
||
549 | 549 | } |
550 | 550 | } |
551 | 551 | // No pipes, then we know we need to escape |
552 | - elseif (! str_contains($key, '|')) { |
|
552 | + elseif (!str_contains($key, '|')) { |
|
553 | 553 | $escape = 'html'; |
554 | 554 | } |
555 | 555 | // If there's a `noescape` then we're definitely false. |
@@ -557,7 +557,7 @@ discard block |
||
557 | 557 | $escape = false; |
558 | 558 | } |
559 | 559 | // If no `esc` filter is found, then we'll need to add one. |
560 | - elseif (! preg_match('/\s+esc/u', $key)) { |
|
560 | + elseif (!preg_match('/\s+esc/u', $key)) { |
|
561 | 561 | $escape = 'html'; |
562 | 562 | } |
563 | 563 | |
@@ -594,7 +594,7 @@ discard block |
||
594 | 594 | $filter = $param !== [] ? trim(strtolower(substr($filter, 0, strpos($filter, '(')))) : trim($filter); |
595 | 595 | |
596 | 596 | $this->config['filters'] ??= []; |
597 | - if (! array_key_exists($filter, $this->config['filters'])) { |
|
597 | + if (!array_key_exists($filter, $this->config['filters'])) { |
|
598 | 598 | continue; |
599 | 599 | } |
600 | 600 | |
@@ -631,7 +631,7 @@ discard block |
||
631 | 631 | * $matches[1] = all parameters string in opening tag |
632 | 632 | * $matches[2] = content between the tags to send to the plugin. |
633 | 633 | */ |
634 | - if (! preg_match_all($pattern, $template, $matches, PREG_SET_ORDER)) { |
|
634 | + if (!preg_match_all($pattern, $template, $matches, PREG_SET_ORDER)) { |
|
635 | 635 | continue; |
636 | 636 | } |
637 | 637 |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | { |
78 | 78 | helper('assets'); |
79 | 79 | |
80 | - if (! empty($viewPathLocator)) { |
|
80 | + if (!empty($viewPathLocator)) { |
|
81 | 81 | if (is_string($viewPathLocator)) { |
82 | 82 | $this->viewPath = rtrim($viewPathLocator, '\\/ ') . DS; |
83 | 83 | } elseif ($viewPathLocator instanceof LocatorInterface) { |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | } |
86 | 86 | } |
87 | 87 | |
88 | - if (! $this->locator instanceof LocatorInterface && ! is_dir($this->viewPath)) { |
|
88 | + if (!$this->locator instanceof LocatorInterface && !is_dir($this->viewPath)) { |
|
89 | 89 | $this->viewPath = ''; |
90 | 90 | $this->locator = service('locator'); |
91 | 91 | } |
@@ -260,18 +260,18 @@ discard block |
||
260 | 260 | $ext ??= $this->ext; |
261 | 261 | |
262 | 262 | $viewPath = $options['viewPath'] ?? $this->viewPath; |
263 | - $file = ! empty($viewPath) ? str_replace('/', DS, rtrim($viewPath, '/\\') . DS . ltrim($view, '/\\')) : $view; |
|
263 | + $file = !empty($viewPath) ? str_replace('/', DS, rtrim($viewPath, '/\\') . DS . ltrim($view, '/\\')) : $view; |
|
264 | 264 | |
265 | 265 | $file = Helpers::ensureExt($file, $ext); |
266 | 266 | |
267 | - if (! is_file($file) && $this->locator instanceof LocatorInterface) { |
|
267 | + if (!is_file($file) && $this->locator instanceof LocatorInterface) { |
|
268 | 268 | $file = $this->locator->locateFile($view, 'Views', $ext); |
269 | 269 | } |
270 | 270 | |
271 | 271 | $file = realpath($file); |
272 | 272 | |
273 | 273 | // locateFile renverra une chaîne vide si le fichier est introuvable. |
274 | - if (! is_file($file)) { |
|
274 | + if (!is_file($file)) { |
|
275 | 275 | throw ViewException::invalidFile($view); |
276 | 276 | } |
277 | 277 |
@@ -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 | |
@@ -298,14 +298,14 @@ discard block |
||
298 | 298 | return; |
299 | 299 | } |
300 | 300 | |
301 | - if (is_cli() && ! on_test()) { |
|
301 | + if (is_cli() && !on_test()) { |
|
302 | 302 | // @codeCoverageIgnoreStart |
303 | 303 | // $this->request = Services::clirequest($this->config); |
304 | 304 | // @codeCoverageIgnoreEnd |
305 | 305 | } |
306 | 306 | |
307 | 307 | $version = $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.1'; |
308 | - if (! is_numeric($version)) { |
|
308 | + if (!is_numeric($version)) { |
|
309 | 309 | $version = substr($version, strpos($version, '/') + 1); |
310 | 310 | } |
311 | 311 | |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | // Supposons le succès jusqu'à preuve du contraire. |
325 | 325 | $this->response = service('response')->withStatus(200); |
326 | 326 | |
327 | - if (! is_cli() || on_test()) { |
|
327 | + if (!is_cli() || on_test()) { |
|
328 | 328 | } |
329 | 329 | |
330 | 330 | $this->response = $this->response->withProtocolVersion($this->request->getProtocolVersion()); |
@@ -408,7 +408,7 @@ discard block |
||
408 | 408 | } |
409 | 409 | |
410 | 410 | // Essayez de charger automatiquement la classe |
411 | - if (! class_exists($this->controller, true) || ($this->method[0] === '_' && $this->method !== '__invoke')) { |
|
411 | + if (!class_exists($this->controller, true) || ($this->method[0] === '_' && $this->method !== '__invoke')) { |
|
412 | 412 | throw PageNotFoundException::controllerNotFound($this->controller, $this->method); |
413 | 413 | } |
414 | 414 | |
@@ -499,7 +499,7 @@ discard block |
||
499 | 499 | |
500 | 500 | $this->outputBufferingEnd(); |
501 | 501 | |
502 | - throw PageNotFoundException::pageNotFound(! on_prod() || is_cli() ? $e->getMessage() : ''); |
|
502 | + throw PageNotFoundException::pageNotFound(!on_prod() || is_cli() ? $e->getMessage() : ''); |
|
503 | 503 | } |
504 | 504 | |
505 | 505 | /** |
@@ -541,7 +541,7 @@ discard block |
||
541 | 541 | public function storePreviousURL($uri) |
542 | 542 | { |
543 | 543 | // Ignorer les requêtes CLI |
544 | - if (is_cli() && ! on_test()) { |
|
544 | + if (is_cli() && !on_test()) { |
|
545 | 545 | return; // @codeCoverageIgnore |
546 | 546 | } |
547 | 547 | |
@@ -551,7 +551,7 @@ discard block |
||
551 | 551 | } |
552 | 552 | |
553 | 553 | // Ignorer les reponses non-HTML |
554 | - if (! str_contains($this->response->getHeaderLine('Content-Type'), 'text/html')) { |
|
554 | + if (!str_contains($this->response->getHeaderLine('Content-Type'), 'text/html')) { |
|
555 | 555 | return; |
556 | 556 | } |
557 | 557 | |
@@ -575,7 +575,7 @@ discard block |
||
575 | 575 | */ |
576 | 576 | protected function sendResponse() |
577 | 577 | { |
578 | - if (! $this->isAjaxRequest()) { |
|
578 | + if (!$this->isAjaxRequest()) { |
|
579 | 579 | $this->response = service('toolbar')->prepare( |
580 | 580 | $this->getPerformanceStats(), |
581 | 581 | $this->request, |
@@ -672,12 +672,12 @@ discard block |
||
672 | 672 | */ |
673 | 673 | private function spoofRequestMethod(): callable |
674 | 674 | { |
675 | - return static function (ServerRequestInterface $request, ResponseInterface $response, callable $next) { |
|
675 | + return static function(ServerRequestInterface $request, ResponseInterface $response, callable $next) { |
|
676 | 676 | $post = $request->getParsedBody(); |
677 | 677 | |
678 | 678 | // Ne fonctionne qu'avec les formulaires POST |
679 | 679 | // Accepte seulement PUT, PATCH, DELETE |
680 | - if ($request->getMethod() === Method::POST && ! empty($post['_method']) && in_array($post['_method'], [Method::PUT, Method::PATCH, Method::DELETE], true)) { |
|
680 | + if ($request->getMethod() === Method::POST && !empty($post['_method']) && in_array($post['_method'], [Method::PUT, Method::PATCH, Method::DELETE], true)) { |
|
681 | 681 | $request = $request->withMethod($post['_method']); |
682 | 682 | } |
683 | 683 | |
@@ -687,7 +687,7 @@ discard block |
||
687 | 687 | |
688 | 688 | private function bootApp(): callable |
689 | 689 | { |
690 | - return function (ServerRequestInterface $request, ResponseInterface $response, callable $next): ResponseInterface { |
|
690 | + return function(ServerRequestInterface $request, ResponseInterface $response, callable $next): ResponseInterface { |
|
691 | 691 | Services::set(Request::class, $request); |
692 | 692 | Services::set(Response::class, $response); |
693 | 693 | |
@@ -695,10 +695,10 @@ discard block |
||
695 | 695 | $returned = $this->startController(); |
696 | 696 | |
697 | 697 | // Les controleur sous forme de Closure sont executes dans startController(). |
698 | - if (! is_callable($this->controller)) { |
|
698 | + if (!is_callable($this->controller)) { |
|
699 | 699 | $controller = $this->createController($request, $response); |
700 | 700 | |
701 | - if (! method_exists($controller, '_remap') && ! is_callable([$controller, $this->method], false)) { |
|
701 | + if (!method_exists($controller, '_remap') && !is_callable([$controller, $this->method], false)) { |
|
702 | 702 | throw PageNotFoundException::methodNotFound($this->method); |
703 | 703 | } |
704 | 704 |