Test Failed
Branch main (50345c)
by Dimitri
03:34
created
src/Controllers/RestController.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
         $this->config = (object) config('rest');
73 73
 
74 74
         $locale       = $this->config->language ?? null;
75
-        $this->locale = ! empty($locale) ? $locale : $this->request->getLocale();
75
+        $this->locale = !empty($locale) ? $locale : $this->request->getLocale();
76 76
     }
77 77
 
78 78
     public function _remap(string $method, array $params = [])
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
         $class = static::class;
81 81
 
82 82
         // Bien sûr qu'il existe, mais peuvent-ils en faire quelque chose ?
83
-        if (! method_exists($class, $method)) {
83
+        if (!method_exists($class, $method)) {
84 84
             return $this->respondNotImplemented($this->_translate('notImplemented', [$class, $method]));
85 85
         }
86 86
 
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 
108 108
             return $this->respondOk($response);
109 109
         } catch (Throwable $ex) {
110
-            if (! on_dev()) {
110
+            if (!on_dev()) {
111 111
                 $url = explode('?', $this->request->getRequestTarget())[0];
112 112
 
113 113
                 return $this->respondBadRequest($this->_translate('badUsed', [$url]));
@@ -156,18 +156,18 @@  discard block
 block discarded – undo
156 156
     final protected function respondFail(?string $message = "Une erreur s'est produite", ?int $status = StatusCode::INTERNAL_ERROR, null|int|string $code = null, array $errors = [])
157 157
     {
158 158
         $message = $message ?: "Une erreur s'est produite";
159
-        $code    = ! empty($code) ? $code : $status;
159
+        $code    = !empty($code) ? $code : $status;
160 160
 
161 161
         $response = [
162 162
             $this->config->field['message'] ?? 'message' => $message,
163 163
         ];
164
-        if (! empty($this->config->field['status'])) {
164
+        if (!empty($this->config->field['status'])) {
165 165
             $response[$this->config->field['status']] = false;
166 166
         }
167
-        if (! empty($this->config->field['code'])) {
167
+        if (!empty($this->config->field['code'])) {
168 168
             $response[$this->config->field['code']] = $code;
169 169
         }
170
-        if (! empty($errors)) {
170
+        if (!empty($errors)) {
171 171
             $response[$this->config->field['errors'] ?? 'errors'] = $errors;
172 172
         }
173 173
 
@@ -188,12 +188,12 @@  discard block
 block discarded – undo
188 188
     final protected function respondSuccess(?string $message = 'Resultat', $result = null, ?int $status = StatusCode::OK)
189 189
     {
190 190
         $message = $message ?: 'Resultat';
191
-        $status  = ! empty($status) ? $status : StatusCode::OK;
191
+        $status  = !empty($status) ? $status : StatusCode::OK;
192 192
 
193 193
         $response = [
194 194
             $this->config->field['message'] ?? 'message' => $message,
195 195
         ];
196
-        if (! empty($this->config->field['status'])) {
196
+        if (!empty($this->config->field['status'])) {
197 197
             $response[$this->config->field['status']] = true;
198 198
         }
199 199
         if (is_array($result)) {
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
      */
309 309
     final protected function allowedMethods(string ...$methods): self
310 310
     {
311
-        if (! empty($methods)) {
311
+        if (!empty($methods)) {
312 312
             $this->config->allowed_methods = array_map(static fn ($str) => strtoupper($str), $methods);
313 313
         }
314 314
 
@@ -406,13 +406,13 @@  discard block
 block discarded – undo
406 406
         }
407 407
 
408 408
         // Si la méthode de format existe, appelle et renvoie la sortie dans ce format
409
-        if (! empty($mime)) {
409
+        if (!empty($mime)) {
410 410
             $output = Formatter::type($mime)->format($data);
411 411
 
412 412
             // Définit l'en-tête du format
413 413
             // Ensuite, vérifiez si le client a demandé un rappel, et si la sortie contient ce rappel :
414 414
             $callback = $this->request->getQuery('callback');
415
-            if (! empty($callback) && $mime === $this->mimes['json'] && preg_match('/^' . $callback . '/', $output)) {
415
+            if (!empty($callback) && $mime === $this->mimes['json'] && preg_match('/^' . $callback . '/', $output)) {
416 416
                 $this->response = $this->response->withType($this->mimes['jsonp']);
417 417
             } else {
418 418
                 $this->response = $this->response->withType($mime === $this->mimes['array'] ? $this->mimes['json'] : $mime);
@@ -468,22 +468,22 @@  discard block
 block discarded – undo
468 468
     private function checkProcess(): bool|ResponseInterface
469 469
     {
470 470
         // Verifie si la requete est en ajax
471
-        if (! $this->request->is('ajax') && $this->config->ajax_only) {
471
+        if (!$this->request->is('ajax') && $this->config->ajax_only) {
472 472
             return $this->respondNotAcceptable($this->_translate('ajaxOnly'));
473 473
         }
474 474
 
475 475
         // Verifie si la requete est en https
476
-        if (! $this->request->is('https') && $this->config->force_https) {
476
+        if (!$this->request->is('https') && $this->config->force_https) {
477 477
             return $this->respondForbidden($this->_translate('unsupported'));
478 478
         }
479 479
 
480 480
         // Verifie si la methode utilisee pour la requete est autorisee
481
-        if (! in_array(strtoupper($this->request->getMethod()), $this->config->allowed_methods, true)) {
481
+        if (!in_array(strtoupper($this->request->getMethod()), $this->config->allowed_methods, true)) {
482 482
             return $this->respondNotAcceptable($this->_translate('unknownMethod'));
483 483
         }
484 484
 
485 485
         // Verifie que l'ip qui emet la requete n'est pas dans la blacklist
486
-        if (! empty($this->config->ip_blacklis)) {
486
+        if (!empty($this->config->ip_blacklis)) {
487 487
             $this->config->ip_blacklist = implode(',', $this->config->ip_blacklist);
488 488
 
489 489
             // Correspond à une adresse IP dans une liste noire, par ex. 127.0.0.0, 0.0.0.0
@@ -496,20 +496,20 @@  discard block
 block discarded – undo
496 496
         }
497 497
 
498 498
         // Verifie que l'ip qui emet la requete est dans la whitelist
499
-        if (! empty($this->config->ip_whitelist)) {
499
+        if (!empty($this->config->ip_whitelist)) {
500 500
             $whitelist = $this->config->ip_whitelist;
501 501
             array_push($whitelist, '127.0.0.1', '0.0.0.0');
502 502
 
503 503
             // coupez les espaces de début et de fin des ip
504 504
             $whitelist = array_map('trim', $whitelist);
505 505
 
506
-            if (! in_array($this->request->clientIp(), $whitelist, true)) {
506
+            if (!in_array($this->request->clientIp(), $whitelist, true)) {
507 507
                 return $this->respondUnauthorized($this->_translate('ipUnauthorized'));
508 508
             }
509 509
         }
510 510
 
511 511
         // Verifie l'authentification du client
512
-        if (false !== $this->config->auth && ! $this->request->is('options')) {
512
+        if (false !== $this->config->auth && !$this->request->is('options')) {
513 513
             if ('bearer' === strtolower($this->config->auth)) {
514 514
                 $token = $this->getBearerToken();
515 515
                 if (empty($token)) {
Please login to merge, or discard this patch.
src/Event/EventDiscover.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
         foreach ($files as $file) {
36 36
             $className = $this->locator->getClassname($file);
37 37
 
38
-            if ($className === '' || ! class_exists($className) || ! is_a($className, EventListenerInterface::class, true)) {
38
+            if ($className === '' || !class_exists($className) || !is_a($className, EventListenerInterface::class, true)) {
39 39
                 continue;
40 40
             }
41 41
 
Please login to merge, or discard this patch.
src/Cli/Traits/GeneratorTrait.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
             // @codeCoverageIgnoreStart
121 121
             $this->colorize(lang('CLI.generator.usingBlitzNamespace'), 'yellow');
122 122
 
123
-            if (! $this->confirm('Are you sure you want to continue?')) {
123
+            if (!$this->confirm('Are you sure you want to continue?')) {
124 124
                 $this->eol()->colorize(lang('CLI.generator.cancelOperation'), 'yellow');
125 125
 
126 126
                 return;
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 
135 135
         // Écraser des fichiers sans le savoir est une gêne sérieuse, nous allons donc vérifier si nous dupliquons des choses,
136 136
         // si l'option "forcer" n'est pas fournie, nous renvoyons.
137
-        if (! $this->option('force') && $isFile) {
137
+        if (!$this->option('force') && $isFile) {
138 138
             $this->io->error(lang('CLI.generator.fileExist', [clean_path($target)]), true);
139 139
 
140 140
             return;
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
         // Vérifie si le répertoire pour enregistrer le fichier existe.
144 144
         $dir = dirname($target);
145 145
 
146
-        if (! is_dir($dir)) {
146
+        if (!is_dir($dir)) {
147 147
             mkdir($dir, 0o755, true);
148 148
         }
149 149
 
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
         // Construisez la classe en fonction des détails dont nous disposons.
153 153
         // Nous obtiendrons le contenu de notre fichier à partir du modèle,
154 154
         // puis nous effectuerons les remplacements nécessaires.
155
-        if (! write_file($target, $content)) {
155
+        if (!write_file($target, $content)) {
156 156
             // @codeCoverageIgnoreStart
157 157
             $this->io->error(lang('CLI.generator.fileError', [clean_path($target)]), true);
158 158
 
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
             $class = $matches[1] . ucfirst($matches[2]);
227 227
         }
228 228
 
229
-        if ($this->enabledSuffixing && $this->getOption('suffix') && ! strripos($class, $component)) {
229
+        if ($this->enabledSuffixing && $this->getOption('suffix') && !strripos($class, $component)) {
230 230
             $class .= ucfirst($component);
231 231
         }
232 232
 
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 
298 298
         $base = Services::autoloader()->getNamespace($namespace);
299 299
 
300
-        if (! $base = reset($base)) {
300
+        if (!$base = reset($base)) {
301 301
             $this->io->error(lang('CLI.namespaceNotDefined', [$namespace]), true);
302 302
 
303 303
             return '';
Please login to merge, or discard this patch.
src/Cli/Traits/ContentReplacer.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -66,14 +66,14 @@
 block discarded – undo
66 66
 
67 67
         $directory = dirname($path);
68 68
 
69
-        if (! is_dir($directory)) {
69
+        if (!is_dir($directory)) {
70 70
             mkdir($directory, 0o777, true);
71 71
         }
72 72
 
73 73
         if (file_exists($path)) {
74 74
             $overwrite = (bool) $this->option('f');
75 75
 
76
-            if (! $overwrite && ! $this->confirm("Le fichier '{$cleanPath}' existe déjà dans la destination. Le remplacé?")) {
76
+            if (!$overwrite && !$this->confirm("Le fichier '{$cleanPath}' existe déjà dans la destination. Le remplacé?")) {
77 77
                 $this->error("{$cleanPath} sauté. Si vous souhaitez le remplacer, s'il vous plaît utiliser l'option '-f' ou répondre 'y' à l'invite.")->eol();
78 78
 
79 79
                 return;
Please login to merge, or discard this patch.
src/Mail/Mail.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
      */
112 112
     protected function factory(): AbstractAdapter
113 113
     {
114
-        if (! empty($this->adapter)) {
114
+        if (!empty($this->adapter)) {
115 115
             return $this->adapter;
116 116
         }
117 117
 
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
             $handler = static::$validHandlers[$handler];
126 126
         }
127 127
 
128
-        if (! class_exists($handler)) {
128
+        if (!class_exists($handler)) {
129 129
             throw new InvalidArgumentException(lang('Mail.invalidHandler', [$handler]));
130 130
         }
131 131
 
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
             $debug = on_dev();
135 135
         }
136 136
 
137
-        if (! is_subclass_of($handler, AbstractAdapter::class)) {
137
+        if (!is_subclass_of($handler, AbstractAdapter::class)) {
138 138
             throw new InvalidArgumentException(lang('Mail.handlerMustExtendClass', [$handler, AbstractAdapter::class]));
139 139
         }
140 140
 
@@ -340,15 +340,15 @@  discard block
 block discarded – undo
340 340
         $path = '';
341 341
 
342 342
         // N'est-il pas namespaced ? on cherche le dossier en fonction du parametre "view_base"
343
-        if (! str_contains($view, '\\')) {
343
+        if (!str_contains($view, '\\')) {
344 344
             $path = $this->config['view_dir'] ?? '';
345
-            if (! empty($path)) {
345
+            if (!empty($path)) {
346 346
                 $path .= '/';
347 347
             }
348 348
         }
349 349
 
350 350
         $view = view($path . $view, $data);
351
-        if (! empty($this->config['template'])) {
351
+        if (!empty($this->config['template'])) {
352 352
             $view->setLayout($this->config['template']);
353 353
         }
354 354
 
Please login to merge, or discard this patch.
src/Loader/DotEnv.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 
73 73
         foreach ($data as $key => $value) {
74 74
             $replacementKey = "\n{$key} = {$value}";
75
-            if (! str_contains($oldFileContents, $key)) {
75
+            if (!str_contains($oldFileContents, $key)) {
76 76
                 if (file_put_contents($this->path, $replacementKey, FILE_APPEND) === false) {
77 77
                     return false;
78 78
                 }
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
             }
103 103
         }
104 104
 
105
-        if (! count($data)) {
105
+        if (!count($data)) {
106 106
             return false;
107 107
         }
108 108
 
@@ -139,18 +139,18 @@  discard block
 block discarded – undo
139 139
     public function parse(): ?array
140 140
     {
141 141
         // Nous ne voulons pas imposer la présence d'un fichier .env, ils devraient être facultatifs.
142
-        if (! is_file($this->path)) {
142
+        if (!is_file($this->path)) {
143 143
             return null;
144 144
         }
145 145
 
146 146
         // Assurez-vous que le fichier est lisible
147
-        if (! is_readable($this->path)) {
147
+        if (!is_readable($this->path)) {
148 148
             throw new InvalidArgumentException("The .env file is not readable: {$this->path}");
149 149
         }
150 150
 
151 151
         $vars = [];
152 152
 
153
-        $lines = file($this->path, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
153
+        $lines = file($this->path, FILE_IGNORE_NEW_LINES|FILE_SKIP_EMPTY_LINES);
154 154
 
155 155
         foreach ($lines as $line) {
156 156
             // C'est un commentaire?
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
      */
176 176
     protected function setVariable(string $name, string $value = '')
177 177
     {
178
-        if (! getenv($name, true)) {
178
+        if (!getenv($name, true)) {
179 179
             putenv("{$name}={$value}");
180 180
         }
181 181
         if (empty($_ENV[$name])) {
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
      */
225 225
     protected function sanitizeValue(string $value): string
226 226
     {
227
-        if (! $value) {
227
+        if (!$value) {
228 228
             return $value;
229 229
         }
230 230
 
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
 
281 281
             $value = preg_replace_callback(
282 282
                 '/\${([a-zA-Z0-9_]+)}/',
283
-                static function ($matchedPatterns) use ($loader) {
283
+                static function($matchedPatterns) use ($loader) {
284 284
                     $nestedVariable = $loader->getVariable($matchedPatterns[1]);
285 285
 
286 286
                     if (null === $nestedVariable) {
Please login to merge, or discard this patch.
src/Loader/FileLocator.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 
39 39
         $loader = Services::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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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,22 +147,22 @@  discard block
 block discarded – undo
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
-        if (! empty($file)) {
159
+        if (!empty($file)) {
160 160
             $schema = require $file;
161 161
         } else {
162 162
             $schema = null;
163 163
         }
164 164
 
165
-        if (empty($schema) || ! ($schema instanceof Schema)) {
165
+        if (empty($schema) || !($schema instanceof Schema)) {
166 166
             $schema = Expect::mixed();
167 167
         }
168 168
 
@@ -180,16 +180,16 @@  discard block
 block discarded – undo
180 180
      */
181 181
     public static function model(string $model, ?ConnectionInterface $connection = null)
182 182
     {
183
-        if (! class_exists($model) && ! Text::endsWith($model, 'Model')) {
183
+        if (!class_exists($model) && !Text::endsWith($model, 'Model')) {
184 184
             $model .= 'Model';
185 185
         }
186 186
 
187
-        if (! class_exists($model)) {
187
+        if (!class_exists($model)) {
188 188
             $model = str_replace(APP_NAMESPACE . '\\Models\\', '', $model);
189 189
             $model = APP_NAMESPACE . '\\Models\\' . $model;
190 190
         }
191 191
 
192
-        if (! class_exists($model)) {
192
+        if (!class_exists($model)) {
193 193
             throw LoadException::modelNotFound($model);
194 194
         }
195 195
 
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
     protected static function verifyPreferApp(array $options, string $name): bool
219 219
     {
220 220
         // Tout element sans restriction passe
221
-        if (! $options['preferApp']) {
221
+        if (!$options['preferApp']) {
222 222
             return true;
223 223
         }
224 224
 
Please login to merge, or discard this patch.
src/Publisher/Publisher.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
             // Essayez plusieurs fois en cas de mèches persistantes
128 128
             $attempts = 10;
129 129
 
130
-            while ((bool) $attempts && ! delete_files($directory, true, false, true)) {
130
+            while ((bool) $attempts && !delete_files($directory, true, false, true)) {
131 131
                 // @codeCoverageIgnoreStart
132 132
                 $attempts--;
133 133
                 usleep(100000); // .1s
@@ -467,7 +467,7 @@  discard block
 block discarded – undo
467 467
         // Rechercher un fichier existant
468 468
         if (file_exists($to)) {
469 469
             // S'il n'est pas remplacé ou si les fichiers sont identiques, envisagez de réussir
470
-            if (! $replace || same_file($from, $to)) {
470
+            if (!$replace || same_file($from, $to)) {
471 471
                 return;
472 472
             }
473 473
 
@@ -481,7 +481,7 @@  discard block
 block discarded – undo
481 481
         }
482 482
 
483 483
         // Assurez-vous que le répertoire existe
484
-        if (! is_dir($directory = pathinfo($to, PATHINFO_DIRNAME))) {
484
+        if (!is_dir($directory = pathinfo($to, PATHINFO_DIRNAME))) {
485 485
             mkdir($directory, 0o775, true);
486 486
         }
487 487
 
Please login to merge, or discard this patch.
src/Http/Redirection.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 
64 64
         // Si cela semble être une URL relative, alors convertissez-la en URL complète
65 65
         // pour une meilleure sécurité.
66
-        if (! str_starts_with($uri, 'http')) {
66
+        if (!str_starts_with($uri, 'http')) {
67 67
             $uri = site_url($uri);
68 68
         }
69 69
 
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
     {
125 125
         $request = $this->generator->getRequest();
126 126
 
127
-        $intended = $request->method() === 'GET' && ! $request->expectsJson()
127
+        $intended = $request->method() === 'GET' && !$request->expectsJson()
128 128
                         ? $this->generator->full()
129 129
                         : $this->generator->previous();
130 130
 
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
             $errors = [$key => $errors];
179 179
         }
180 180
 
181
-        if (! empty($errors)) {
181
+        if (!empty($errors)) {
182 182
             Services::viewer()->share('errors', new ErrorBag($this->session->flashErrors($errors, $key)));
183 183
         }
184 184
 
Please login to merge, or discard this patch.