Passed
Push — main ( 91afa7...6ce554 )
by Dimitri
03:06
created
src/View/Adapters/AbstractAdapter.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
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) {
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
         $options = (array) $options;
222 222
 
223 223
         $viewPath = $options['viewPath'] ?? $this->viewPath;
224
-        if (! empty($viewPath)) {
224
+        if (!empty($viewPath)) {
225 225
             $file = str_replace('/', DS, rtrim($viewPath, '/\\') . DS . ltrim($view, '/\\'));
226 226
         } else {
227 227
             $file = $view;
@@ -229,12 +229,12 @@  discard block
 block discarded – undo
229 229
 
230 230
         $file = Helpers::ensureExt($file, $ext);
231 231
 
232
-        if (! is_file($file) && $this->locator instanceof Locator) {
232
+        if (!is_file($file) && $this->locator instanceof Locator) {
233 233
             $file = $this->locator->locateFile($view, 'Views', empty($ext) ? 'php' : $ext);
234 234
         }
235 235
 
236 236
         // locateFile renverra une chaîne vide si le fichier est introuvable.
237
-        if (! is_file($file)) {
237
+        if (!is_file($file)) {
238 238
             throw ViewException::invalidFile($view);
239 239
         }
240 240
 
Please login to merge, or discard this patch.
src/Mail/Adapters/SymfonyMailer.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
 
423 423
     private function buildDsn(): string
424 424
     {
425
-        if (! empty($this->dsn)) {
425
+        if (!empty($this->dsn)) {
426 426
             return $this->dsn;
427 427
         }
428 428
 
@@ -430,8 +430,8 @@  discard block
 block discarded – undo
430 430
             static::PROTOCOL_SMTP     => "smtp://{$this->username}:{$this->password}@{$this->host}:{$this->port}",
431 431
             static::PROTOCOL_SENDMAIL => 'sendmail://default',
432 432
             static::PROTOCOL_MAIL     => 'sendmail://default',
433
-            static::PROTOCOL_POSTMARK => "postmark+smtp://{$this->username}@default",                                // username joue le role de ID
434
-            static::PROTOCOL_SENDGRID => "sendgrid+smtp://apikey:{$this->username}@default",                         // username joue le role de API_KEY
433
+            static::PROTOCOL_POSTMARK => "postmark+smtp://{$this->username}@default", // username joue le role de ID
434
+            static::PROTOCOL_SENDGRID => "sendgrid+smtp://apikey:{$this->username}@default", // username joue le role de API_KEY
435 435
             default                   => "{$this->protocol}+smtp://{$this->username}:{$this->password}@default",
436 436
         };
437 437
     }
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 = function ($str, $level) {
35
+        $this->mailer->Debugoutput = 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): self
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/Mail/Adapters/AbstractAdapter.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -40,11 +40,11 @@
 block discarded – undo
40 40
             if (empty($dependency['class']) || empty($dependency['package'])) {
41 41
                 throw new InvalidArgumentException('Invalid dependencies property');
42 42
             }
43
-            if (! is_string($dependency['class']) || ! is_string($dependency['package'])) {
43
+            if (!is_string($dependency['class']) || !is_string($dependency['package'])) {
44 44
                 throw new InvalidArgumentException('Invalid dependencies property');
45 45
             }
46 46
 
47
-            if (! class_exists($dependency['class'])) {
47
+            if (!class_exists($dependency['class'])) {
48 48
                 throw new RuntimeException(lang('Mail.dependancyNotFound', [$dependency['class'], static::class, $dependency['package']]));
49 49
             }
50 50
         }
Please login to merge, or discard this patch.
src/Mail/Mail.php 1 patch
Spacing   +5 added lines, -5 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
 
@@ -342,13 +342,13 @@  discard block
 block discarded – undo
342 342
         // N'est-il pas namespaced ? on cherche le dossier en fonction du parametre "view_base"
343 343
         if (strpos($view, '\\') === false) {
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/Mail/Mailable.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
     public function send(Mail $mail): bool
174 174
     {
175 175
         foreach ($this->bcc() as $key => $value) {
176
-            if (empty($value) || ! is_string($value)) {
176
+            if (empty($value) || !is_string($value)) {
177 177
                 continue;
178 178
             }
179 179
 
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
         }
186 186
 
187 187
         foreach ($this->cc() as $key => $value) {
188
-            if (empty($value) || ! is_string($value)) {
188
+            if (empty($value) || !is_string($value)) {
189 189
                 continue;
190 190
             }
191 191
 
@@ -198,12 +198,12 @@  discard block
 block discarded – undo
198 198
 
199 199
         $content = $this->content();
200 200
 
201
-        if (! empty($content['view'])) {
201
+        if (!empty($content['view'])) {
202 202
             $mail->view($content['view'], $this->data());
203
-        } elseif (! empty($content['html'])) {
203
+        } elseif (!empty($content['html'])) {
204 204
             $mail->html($content['html']);
205 205
         }
206
-        if (! empty($content['text'])) {
206
+        if (!empty($content['text'])) {
207 207
             $mail->text($content['text']);
208 208
         }
209 209
 
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
         $mail->priority($this->priority());
213 213
 
214 214
         foreach ($this->replyTo() as $key => $value) {
215
-            if (empty($value) || ! is_string($value)) {
215
+            if (empty($value) || !is_string($value)) {
216 216
                 continue;
217 217
             }
218 218
 
Please login to merge, or discard this patch.
src/Router/Router.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
         // Toujours là ? Ensuite, nous pouvons essayer de faire correspondre l'URI avec
168 168
         // Contrôleurs/répertoires, mais l'application peut ne pas
169 169
         // vouloir ceci, comme dans le cas des API.
170
-        if (! $this->collection->shouldAutoRoute()) {
170
+        if (!$this->collection->shouldAutoRoute()) {
171 171
             $verb = strtolower($this->collection->getHTTPVerb());
172 172
 
173 173
             throw new PageNotFoundException("Impossible de trouver une route pour '{$verb}: {$uri}'.");
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
      */
196 196
     public function controllerName()
197 197
     {
198
-        if (! is_string($this->controller)) {
198
+        if (!is_string($this->controller)) {
199 199
             return $this->controller;
200 200
         }
201 201
 
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 
236 236
             return [
237 237
                 $routeArray[0], // Controller
238
-                $routeArray[1] ?? 'index',   // Method
238
+                $routeArray[1] ?? 'index', // Method
239 239
             ];
240 240
         }
241 241
 
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
                 // Cette route est-elle censée rediriger vers une autre ?
360 360
                 if ($this->collection->isRedirect($routeKey)) {
361 361
                     // remplacement des groupes de routes correspondants par des références : post/([0-9]+) -> post/$1
362
-                    $redirectTo = preg_replace_callback('/(\([^\(]+\))/', static function () {
362
+                    $redirectTo = preg_replace_callback('/(\([^\(]+\))/', static function() {
363 363
                         static $i = 1;
364 364
 
365 365
                         return '$' . $i++;
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
                     );
380 380
 
381 381
                     if ($this->collection->shouldUseSupportedLocalesOnly()
382
-                        && ! in_array($matched['locale'], config('App')->supportedLocales, true)) {
382
+                        && !in_array($matched['locale'], config('App')->supportedLocales, true)) {
383 383
                         // Lancer une exception pour empêcher l'autorouteur,
384 384
                         // si activé, essayer de trouver une route
385 385
                         throw PageNotFoundException::localeNotSupported($matched['locale']);
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
 
392 392
                 // Utilisons-nous Closures ? Si tel est le cas, nous devons collecter les paramètres dans un tableau
393 393
                 // afin qu'ils puissent être transmis ultérieurement à la méthode du contrôleur.
394
-                if (! is_string($handler) && is_callable($handler)) {
394
+                if (!is_string($handler) && is_callable($handler)) {
395 395
                     $this->controller = $handler;
396 396
 
397 397
                     // Supprime la chaîne d'origine du tableau matches
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
 
490 490
         // $this->method contient déjà le nom de la méthode par défaut,
491 491
         // donc ne l'écrasez pas avec le vide.
492
-        if (! empty($method)) {
492
+        if (!empty($method)) {
493 493
             $this->setMethod($method);
494 494
         }
495 495
 
@@ -512,7 +512,7 @@  discard block
 block discarded – undo
512 512
             $this->method = $this->collection->getDefaultMethod();
513 513
         }
514 514
 
515
-        if (! is_file(CONTROLLER_PATH . $this->directory . $this->makeController($class) . '.php')) {
515
+        if (!is_file(CONTROLLER_PATH . $this->directory . $this->makeController($class) . '.php')) {
516 516
             return;
517 517
         }
518 518
 
Please login to merge, or discard this patch.
src/Router/Dispatcher.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
             $controller = $routes->getDefaultController();
172 172
         }
173 173
 
174
-        if (! $fullName && is_string($controller)) {
174
+        if (!$fullName && is_string($controller)) {
175 175
             $controller = str_replace($routes->getDefaultNamespace(), '', $controller);
176 176
         }
177 177
 
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
          */
281 281
         $this->gatherOutput($this->middleware->handle($this->request));
282 282
 
283
-        if (! $this->returnResponse) {
283
+        if (!$this->returnResponse) {
284 284
             $this->sendResponse();
285 285
         }
286 286
 
@@ -328,14 +328,14 @@  discard block
 block discarded – undo
328 328
             return;
329 329
         }
330 330
 
331
-        if (is_cli() && ! on_test()) {
331
+        if (is_cli() && !on_test()) {
332 332
             // @codeCoverageIgnoreStart
333 333
             // $this->request = Services::clirequest($this->config);
334 334
             // @codeCoverageIgnoreEnd
335 335
         }
336 336
 
337 337
         $version = $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.1';
338
-        if (! is_numeric($version)) {
338
+        if (!is_numeric($version)) {
339 339
             $version = substr($version, strpos($version, '/') + 1);
340 340
         }
341 341
 
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
         // Supposons le succès jusqu'à preuve du contraire.
355 355
         $this->response = Services::response()->withStatus(200);
356 356
 
357
-        if (! is_cli() || on_test()) {
357
+        if (!is_cli() || on_test()) {
358 358
         }
359 359
 
360 360
         $this->response = $this->response->withProtocolVersion($this->request->getProtocolVersion());
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
     {
391 391
         if ($cachedResponse = Services::cache()->read($this->generateCacheName())) {
392 392
             $cachedResponse = unserialize($cachedResponse);
393
-            if (! is_array($cachedResponse) || ! isset($cachedResponse['output']) || ! isset($cachedResponse['headers'])) {
393
+            if (!is_array($cachedResponse) || !isset($cachedResponse['output']) || !isset($cachedResponse['headers'])) {
394 394
                 throw new FrameworkException('Erreur lors de la désérialisation du cache de page');
395 395
             }
396 396
 
@@ -523,7 +523,7 @@  discard block
 block discarded – undo
523 523
      */
524 524
     protected function determinePath(): string
525 525
     {
526
-        if (! empty($this->path)) {
526
+        if (!empty($this->path)) {
527 527
             return $this->path;
528 528
         }
529 529
 
@@ -577,7 +577,7 @@  discard block
 block discarded – undo
577 577
         }
578 578
 
579 579
         // Essayez de charger automatiquement la classe
580
-        if (! class_exists($this->controller, true) || ($this->method[0] === '_' && $this->method !== '__invoke')) {
580
+        if (!class_exists($this->controller, true) || ($this->method[0] === '_' && $this->method !== '__invoke')) {
581 581
             throw PageNotFoundException::controllerNotFound($this->controller, $this->method);
582 582
         }
583 583
 
@@ -671,7 +671,7 @@  discard block
 block discarded – undo
671 671
         // Affiche l'erreur 404
672 672
         $this->response = $this->response->withStatus($e->getCode());
673 673
 
674
-        if (! on_test()) {
674
+        if (!on_test()) {
675 675
             // @codeCoverageIgnoreStart
676 676
             if (ob_get_level() > 0) {
677 677
                 ob_end_flush();
@@ -683,7 +683,7 @@  discard block
 block discarded – undo
683 683
             ob_end_flush(); // @codeCoverageIgnore
684 684
         }
685 685
 
686
-        throw PageNotFoundException::pageNotFound(! on_prod() || is_cli() ? $e->getMessage() : '');
686
+        throw PageNotFoundException::pageNotFound(!on_prod() || is_cli() ? $e->getMessage() : '');
687 687
     }
688 688
 
689 689
     /**
@@ -738,7 +738,7 @@  discard block
 block discarded – undo
738 738
     public function storePreviousURL($uri)
739 739
     {
740 740
         // Ignorer les requêtes CLI
741
-        if (is_cli() && ! on_test()) {
741
+        if (is_cli() && !on_test()) {
742 742
             return; // @codeCoverageIgnore
743 743
         }
744 744
 
@@ -845,7 +845,7 @@  discard block
 block discarded – undo
845 845
         ]);
846 846
 
847 847
         $middlewaresFile = CONFIG_PATH . 'middlewares.php';
848
-        if (file_exists($middlewaresFile) && ! in_array($middlewaresFile, get_included_files(), true)) {
848
+        if (file_exists($middlewaresFile) && !in_array($middlewaresFile, get_included_files(), true)) {
849 849
             $middleware = require $middlewaresFile;
850 850
             if (is_callable($middleware)) {
851 851
                 $middleware($this->middleware, $this->request);
@@ -861,11 +861,11 @@  discard block
 block discarded – undo
861 861
      */
862 862
     private function spoofRequestMethod(): callable
863 863
     {
864
-        return static function (ServerRequestInterface $request, ResponseInterface $response, callable $next) {
864
+        return static function(ServerRequestInterface $request, ResponseInterface $response, callable $next) {
865 865
             $post = $request->getParsedBody();
866 866
 
867 867
             // Ne fonctionne qu'avec les formulaires POST
868
-            if (strtoupper($request->getMethod()) === 'POST' && ! empty($post['_method'])) {
868
+            if (strtoupper($request->getMethod()) === 'POST' && !empty($post['_method'])) {
869 869
                 // Accepte seulement PUT, PATCH, DELETE
870 870
                 if (in_array(strtoupper($post['_method']), ['PUT', 'PATCH', 'DELETE'], true)) {
871 871
                     $request = $request->withMethod($post['_method']);
@@ -880,15 +880,15 @@  discard block
 block discarded – undo
880 880
     {
881 881
         $_this = $this;
882 882
 
883
-        return static function (ServerRequestInterface $request, ResponseInterface $response, callable $next) use ($_this): ResponseInterface {
883
+        return static function(ServerRequestInterface $request, ResponseInterface $response, callable $next) use ($_this): ResponseInterface {
884 884
             try {
885 885
                 $returned = $_this->startController($request, $response);
886 886
 
887 887
                 // Closure controller has run in startController().
888
-                if (! is_callable($_this->controller)) {
888
+                if (!is_callable($_this->controller)) {
889 889
                     $controller = $_this->createController($request, $response);
890 890
 
891
-                    if (! method_exists($controller, '_remap') && ! is_callable([$controller, $_this->method], false)) {
891
+                    if (!method_exists($controller, '_remap') && !is_callable([$controller, $_this->method], false)) {
892 892
                         throw PageNotFoundException::methodNotFound($_this->method);
893 893
                     }
894 894
 
Please login to merge, or discard this patch.
src/Controllers/ApplicationController.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -53,15 +53,15 @@
 block discarded – undo
53 53
 
54 54
         $viewer->setData($data)->setOptions($options);
55 55
 
56
-        if (! empty($this->layout) && is_string($this->layout)) {
56
+        if (!empty($this->layout) && is_string($this->layout)) {
57 57
             $viewer->setLayout($this->layout);
58 58
         }
59 59
 
60
-        if (! empty($this->viewDatas) && is_array($this->viewDatas)) {
60
+        if (!empty($this->viewDatas) && is_array($this->viewDatas)) {
61 61
             $viewer->addData($this->viewDatas);
62 62
         }
63 63
 
64
-        if (! is_string($controllerName = Dispatcher::getController(false))) {
64
+        if (!is_string($controllerName = Dispatcher::getController(false))) {
65 65
             $controllerName = static::class;
66 66
         }
67 67
 
Please login to merge, or discard this patch.