Passed
Push — main ( e589da...88b8ff )
by
unknown
18:09 queued 13:41
created
src/Cli/Console/Console.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 
158 158
         foreach ($options as $key => $value) {
159 159
             $key = preg_replace('/^\-\-/', '', $key);
160
-            if (! isset($options[$key])) {
160
+            if (!isset($options[$key])) {
161 161
                 $options[$key] = $value;
162 162
             }
163 163
         }
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
         foreach ($files as $file) {
198 198
             $className = $locator->findQualifiedNameFromPath($file);
199 199
 
200
-            if ($className === false || ! class_exists($className)) {
200
+            if ($className === false || !class_exists($className)) {
201 201
                 continue;
202 202
             }
203 203
 
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
         $class  = new ReflectionClass($className);
224 224
         $logger = $logger ?: Services::logger();
225 225
 
226
-        if (! $class->isInstantiable() || ! $class->isSubclassOf(Command::class)) {
226
+        if (!$class->isInstantiable() || !$class->isSubclassOf(Command::class)) {
227 227
             throw CLIException::invalidCommand($className);
228 228
         }
229 229
 
@@ -250,13 +250,13 @@  discard block
 block discarded – undo
250 250
             $value = (array) $value;
251 251
 
252 252
             $description = $value[0];
253
-            if (! is_string($description)) {
253
+            if (!is_string($description)) {
254 254
                 continue;
255 255
             }
256 256
 
257 257
             $default = $value[1] ?? null;
258 258
             $filter  = $value[2] ?? null;
259
-            if ($filter !== null && ! is_callable($filter)) {
259
+            if ($filter !== null && !is_callable($filter)) {
260 260
                 $filter = null;
261 261
             }
262 262
 
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
             $value = (array) $value;
269 269
 
270 270
             $description = $value[0];
271
-            if (! is_string($description)) {
271
+            if (!is_string($description)) {
272 272
                 continue;
273 273
             }
274 274
 
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
         }
279 279
 
280 280
         $console = $this;
281
-        $action  = function (?array $arguments = [], ?array $options = [], ?bool $suppress = null) use ($instance, $command, $console) {
281
+        $action  = function(?array $arguments = [], ?array $options = [], ?bool $suppress = null) use ($instance, $command, $console) {
282 282
             foreach ($instance->required as $package) {
283 283
                 $package = explode(':', $package);
284 284
                 $version = $package[1] ?? null;
@@ -287,9 +287,9 @@  discard block
 block discarded – undo
287 287
                 /** @var \Ahc\Cli\IO\Interactor $io */
288 288
                 $io = $this->io();
289 289
 
290
-                if (! InstalledVersions::isInstalled($package)) {
290
+                if (!InstalledVersions::isInstalled($package)) {
291 291
                     $io->info('Cette commande nécessite le package "' . $package . '" mais vous ne l\'avez pas', true);
292
-                    if (! $io->confirm('Voulez-vous l\'installer maintenant ?')) {
292
+                    if (!$io->confirm('Voulez-vous l\'installer maintenant ?')) {
293 293
                         return;
294 294
                     }
295 295
 
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
             }
306 306
 
307 307
             $suppress = $suppress ?: $console->suppress;
308
-            if (! $suppress) {
308
+            if (!$suppress) {
309 309
                 $console->start($instance->service);
310 310
             }
311 311
 
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
 
321 321
             $result = $instance->setOptions($options)->setArguments($arguments)->execute($parameters);
322 322
 
323
-            if (! $suppress) {
323
+            if (!$suppress) {
324 324
                 $console->end();
325 325
             }
326 326
 
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
 
336 336
     private function registerException(Logger $logger)
337 337
     {
338
-        $this->onException(static function (Throwable $e, int $exitCode) use ($logger) {
338
+        $this->onException(static function(Throwable $e, int $exitCode) use ($logger) {
339 339
             $logger->error((string) $e, ['exitCode' => $exitCode, 'klinge' => true]);
340 340
 
341 341
             throw new CLIException($e->getMessage(), $exitCode, $e);
Please login to merge, or discard this patch.
src/Mail/Adapters/PHPMailer.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
     public function __construct(bool $debug = false)
33 33
     {
34 34
         $this->mailer              = new Mailer();
35
-        $this->mailer->Debugoutput = static function ($str, $level) {
35
+        $this->mailer->Debugoutput = static function($str, $level) {
36 36
             Services::logger()->info('[Mail][' . $level . ']: ' . $str);
37 37
         };
38 38
 
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
      */
45 45
     public function init(array $config): static
46 46
     {
47
-        if (! empty($config['username']) && ! empty($config['password'])) {
47
+        if (!empty($config['username']) && !empty($config['password'])) {
48 48
             $this->mailer->SMTPAuth = true;
49 49
         }
50 50
 
Please login to merge, or discard this patch.
src/Cli/Commands/Generators/Views/middleware.tpl.php 1 patch
Braces   +15 added lines, -6 removed lines patch added patch discarded remove patch
@@ -11,10 +11,13 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
src/Cli/Commands/Generators/Middleware.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@
 block discarded – undo
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();
Please login to merge, or discard this patch.
src/Debug/ExceptionManager.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -35,9 +35,9 @@  discard block
 block discarded – undo
35 35
      */
36 36
     public static function registerHttpErrors(Run $debugger, array $config): Run
37 37
     {
38
-        return $debugger->pushHandler(static function (Throwable $exception, InspectorInterface $inspector, RunInterface $run) use ($config) {
38
+        return $debugger->pushHandler(static function(Throwable $exception, InspectorInterface $inspector, RunInterface $run) use ($config) {
39 39
             if (true === $config['log']) {
40
-                if (! in_array($exception->getCode(), $config['ignore_codes'], true)) {
40
+                if (!in_array($exception->getCode(), $config['ignore_codes'], true)) {
41 41
                     Services::logger()->error($exception);
42 42
                 }
43 43
             }
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
             $debugger->pushHandler(new PlainTextHandler());
91 91
         }
92 92
 
93
-        if (! is_online()) {
93
+        if (!is_online()) {
94 94
             if (Misc::isAjaxRequest() || Services::request()->isJson()) {
95 95
                 $debugger->pushHandler(new JsonResponseHandler());
96 96
             } else {
Please login to merge, or discard this patch.
src/Controllers/RestController.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
         $this->config = (object) config('rest');
75 75
 
76 76
         $locale       = $this->config->language ?? null;
77
-        $this->locale = ! empty($locale) ? $locale : $this->request->getLocale();
77
+        $this->locale = !empty($locale) ? $locale : $this->request->getLocale();
78 78
     }
79 79
 
80 80
     public function _remap(string $method, array $params = [])
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
         $class = static::class;
83 83
 
84 84
         // Bien sûr qu'il existe, mais peuvent-ils en faire quelque chose ?
85
-        if (! method_exists($class, $method)) {
85
+        if (!method_exists($class, $method)) {
86 86
             return $this->respondNotImplemented($this->_translate('notImplemented', [$class, $method]));
87 87
         }
88 88
 
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
             return $this->respondBadRequest($message, $ex->getCode(), $errors);
130 130
         }
131 131
 
132
-        if (! on_dev()) {
132
+        if (!on_dev()) {
133 133
             $url = explode('?', $this->request->getRequestTarget())[0];
134 134
 
135 135
             return $this->respondBadRequest($this->_translate('badUsed', [$url]));
@@ -177,18 +177,18 @@  discard block
 block discarded – undo
177 177
     final protected function respondFail(?string $message = "Une erreur s'est produite", ?int $status = StatusCode::INTERNAL_ERROR, null|int|string $code = null, array $errors = [])
178 178
     {
179 179
         $message = $message ?: "Une erreur s'est produite";
180
-        $code    = ! empty($code) ? $code : $status;
180
+        $code    = !empty($code) ? $code : $status;
181 181
 
182 182
         $response = [
183 183
             $this->config->field['message'] ?? 'message' => $message,
184 184
         ];
185
-        if (! empty($this->config->field['status'])) {
185
+        if (!empty($this->config->field['status'])) {
186 186
             $response[$this->config->field['status']] = false;
187 187
         }
188
-        if (! empty($this->config->field['code'])) {
188
+        if (!empty($this->config->field['code'])) {
189 189
             $response[$this->config->field['code']] = $code;
190 190
         }
191
-        if (! empty($errors)) {
191
+        if (!empty($errors)) {
192 192
             $response[$this->config->field['errors'] ?? 'errors'] = $errors;
193 193
         }
194 194
 
@@ -209,12 +209,12 @@  discard block
 block discarded – undo
209 209
     final protected function respondSuccess(?string $message = 'Resultat', $result = null, ?int $status = StatusCode::OK)
210 210
     {
211 211
         $message = $message ?: 'Resultat';
212
-        $status  = ! empty($status) ? $status : StatusCode::OK;
212
+        $status  = !empty($status) ? $status : StatusCode::OK;
213 213
 
214 214
         $response = [
215 215
             $this->config->field['message'] ?? 'message' => $message,
216 216
         ];
217
-        if (! empty($this->config->field['status'])) {
217
+        if (!empty($this->config->field['status'])) {
218 218
             $response[$this->config->field['status']] = true;
219 219
         }
220 220
         if (is_array($result)) {
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
      */
322 322
     final protected function allowedMethods(string ...$methods): self
323 323
     {
324
-        if (! empty($methods)) {
324
+        if (!empty($methods)) {
325 325
             $this->config->allowed_methods = array_map(static fn ($str) => strtoupper($str), $methods);
326 326
         }
327 327
 
@@ -419,13 +419,13 @@  discard block
 block discarded – undo
419 419
         }
420 420
 
421 421
         // Si la méthode de format existe, appelle et renvoie la sortie dans ce format
422
-        if (! empty($mime)) {
422
+        if (!empty($mime)) {
423 423
             $output = Formatter::type($mime)->format($data);
424 424
 
425 425
             // Définit l'en-tête du format
426 426
             // Ensuite, vérifiez si le client a demandé un rappel, et si la sortie contient ce rappel :
427 427
             $callback = $this->request->getQuery('callback');
428
-            if (! empty($callback) && $mime === $this->mimes['json'] && preg_match('/^' . $callback . '/', $output)) {
428
+            if (!empty($callback) && $mime === $this->mimes['json'] && preg_match('/^' . $callback . '/', $output)) {
429 429
                 $this->response = $this->response->withType($this->mimes['jsonp']);
430 430
             } else {
431 431
                 $this->response = $this->response->withType($mime === $this->mimes['array'] ? $this->mimes['json'] : $mime);
@@ -481,22 +481,22 @@  discard block
 block discarded – undo
481 481
     private function checkProcess(): bool|ResponseInterface
482 482
     {
483 483
         // Verifie si la requete est en ajax
484
-        if (! $this->request->is('ajax') && $this->config->ajax_only) {
484
+        if (!$this->request->is('ajax') && $this->config->ajax_only) {
485 485
             return $this->respondNotAcceptable($this->_translate('ajaxOnly'));
486 486
         }
487 487
 
488 488
         // Verifie si la requete est en https
489
-        if (! $this->request->is('https') && $this->config->force_https) {
489
+        if (!$this->request->is('https') && $this->config->force_https) {
490 490
             return $this->respondForbidden($this->_translate('unsupported'));
491 491
         }
492 492
 
493 493
         // Verifie si la methode utilisee pour la requete est autorisee
494
-        if (! in_array(strtoupper($this->request->getMethod()), $this->config->allowed_methods, true)) {
494
+        if (!in_array(strtoupper($this->request->getMethod()), $this->config->allowed_methods, true)) {
495 495
             return $this->respondNotAcceptable($this->_translate('unknownMethod'));
496 496
         }
497 497
 
498 498
         // Verifie que l'ip qui emet la requete n'est pas dans la blacklist
499
-        if (! empty($this->config->ip_blacklis)) {
499
+        if (!empty($this->config->ip_blacklis)) {
500 500
             $this->config->ip_blacklist = implode(',', $this->config->ip_blacklist);
501 501
 
502 502
             // Correspond à une adresse IP dans une liste noire, par ex. 127.0.0.0, 0.0.0.0
@@ -509,20 +509,20 @@  discard block
 block discarded – undo
509 509
         }
510 510
 
511 511
         // Verifie que l'ip qui emet la requete est dans la whitelist
512
-        if (! empty($this->config->ip_whitelist)) {
512
+        if (!empty($this->config->ip_whitelist)) {
513 513
             $whitelist = $this->config->ip_whitelist;
514 514
             array_push($whitelist, '127.0.0.1', '0.0.0.0');
515 515
 
516 516
             // coupez les espaces de début et de fin des ip
517 517
             $whitelist = array_map('trim', $whitelist);
518 518
 
519
-            if (! in_array($this->request->clientIp(), $whitelist, true)) {
519
+            if (!in_array($this->request->clientIp(), $whitelist, true)) {
520 520
                 return $this->respondUnauthorized($this->_translate('ipUnauthorized'));
521 521
             }
522 522
         }
523 523
 
524 524
         // Verifie l'authentification du client
525
-        if (false !== $this->config->auth && ! $this->request->is('options')) {
525
+        if (false !== $this->config->auth && !$this->request->is('options')) {
526 526
             if ('bearer' === strtolower($this->config->auth)) {
527 527
                 $token = $this->getBearerToken();
528 528
                 if (empty($token)) {
Please login to merge, or discard this patch.
src/Initializer/bootstrap.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -16,12 +16,12 @@  discard block
 block discarded – undo
16 16
 defined('DS') || define('DS', DIRECTORY_SEPARATOR);
17 17
 
18 18
 // Se rassurer que le dossier courant pointe sur le dossier du front controller
19
-if (! defined('TEST_PATH')) {
19
+if (!defined('TEST_PATH')) {
20 20
     // On doit aussi verifier qu'on n'est pas en phase de test, sinon khalan ne trouvera pas le dossier des specs
21 21
     chdir(WEBROOT);
22 22
 }
23 23
 
24
-return function (array $paths, string $paths_config_file, bool $is_cli) {
24
+return function(array $paths, string $paths_config_file, bool $is_cli) {
25 25
     // Le chemin d'accès vers le dossier de l'application
26 26
     if (is_dir($paths['app'])) {
27 27
         if (($_temp = realpath($paths['app'])) !== false) {
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
     $app = new Application();
105 105
     $app->init();
106 106
 
107
-    if (! $is_cli) {
107
+    if (!$is_cli) {
108 108
         $app->run();
109 109
     }
110 110
 };
Please login to merge, or discard this patch.
src/Cli/Commands/Generators/Views/controller.tpl.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@
 block discarded – undo
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
 	 *
Please login to merge, or discard this patch.
src/Router/AutoRouter.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
             $class = $this->translateURIDashes(ucfirst($segment));
134 134
 
135 135
             // dès que nous rencontrons un segment qui n'est pas compatible PSR-4, arrêter la recherche
136
-            if (! $this->isValidSegment($class)) {
136
+            if (!$this->isValidSegment($class)) {
137 137
                 return false;
138 138
             }
139 139
 
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
             throw new MethodNotFoundException();
342 342
         }
343 343
 
344
-        if (! $refMethod->isPublic()) {
344
+        if (!$refMethod->isPublic()) {
345 345
             throw new MethodNotFoundException();
346 346
         }
347 347
 
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
      */
455 455
     public function directory(): string
456 456
     {
457
-        return ! empty($this->directory) ? $this->directory : '';
457
+        return !empty($this->directory) ? $this->directory : '';
458 458
     }
459 459
 
460 460
     /**
Please login to merge, or discard this patch.