Passed
Push — main ( 3399b6...dd4eea )
by Dimitri
11:50
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/RouteCollection.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
      */
256 256
     public function addPlaceholder($placeholder, ?string $pattern = null): self
257 257
     {
258
-        if (! is_array($placeholder)) {
258
+        if (!is_array($placeholder)) {
259 259
             $placeholder = [$placeholder => $pattern];
260 260
         }
261 261
 
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
 
349 349
         $files    = $this->locator->search('Config/routes.php');
350 350
         $excludes = [
351
-            APP_PATH  . 'Config' . DS . 'routes.php',
351
+            APP_PATH . 'Config' . DS . 'routes.php',
352 352
             SYST_PATH . 'Config' . DS . 'routes.php',
353 353
         ];
354 354
 
@@ -507,7 +507,7 @@  discard block
 block discarded – undo
507 507
             foreach ($collection as $name => $r) {
508 508
                 $key = key($r['route']);
509 509
 
510
-                if (! $withName) {
510
+                if (!$withName) {
511 511
                     $routes[$key] = $r['route'][$key];
512 512
                 } else {
513 513
                     $routes[$key] = [
@@ -888,7 +888,7 @@  discard block
 block discarded – undo
888 888
      *
889 889
      * @param array|Closure|string $to
890 890
      */
891
-    public function match(array $verbs = [], string $from = '', $to = '', ?array $options = null): self
891
+    public function match(array $verbs = [], string $from = '', $to = '', ?array $options = null) : self
892 892
     {
893 893
         if (empty($from) || empty($to)) {
894 894
             throw new InvalidArgumentException('Vous devez fournir les paramètres : $from, $to.');
@@ -1057,7 +1057,7 @@  discard block
 block discarded – undo
1057 1057
                 $to   = $route['route'][$from];
1058 1058
 
1059 1059
                 // on ignore les closures
1060
-                if (! is_string($to)) {
1060
+                if (!is_string($to)) {
1061 1061
                     continue;
1062 1062
                 }
1063 1063
 
@@ -1146,7 +1146,7 @@  discard block
 block discarded – undo
1146 1146
 
1147 1147
         // Construisez notre chaîne résultante, en insérant les $params aux endroits appropriés.
1148 1148
         foreach ($matches[0] as $index => $pattern) {
1149
-            if (! preg_match('#^' . $pattern . '$#u', $params[$index])) {
1149
+            if (!preg_match('#^' . $pattern . '$#u', $params[$index])) {
1150 1150
                 throw RouterException::invalidParameterType();
1151 1151
             }
1152 1152
 
@@ -1224,9 +1224,9 @@  discard block
 block discarded – undo
1224 1224
         }
1225 1225
 
1226 1226
         // Limitation du nom d'hôte ?
1227
-        if (! empty($options['hostname'])) {
1227
+        if (!empty($options['hostname'])) {
1228 1228
             // @todo déterminer s'il existe un moyen de mettre les hôtes sur liste blanche ?
1229
-            if (! $this->checkHostname($options['hostname'])) {
1229
+            if (!$this->checkHostname($options['hostname'])) {
1230 1230
                 return;
1231 1231
             }
1232 1232
 
@@ -1234,10 +1234,10 @@  discard block
 block discarded – undo
1234 1234
         }
1235 1235
 
1236 1236
         // Limitation du nom sous-domaine ?
1237
-        elseif (! empty($options['subdomain'])) {
1237
+        elseif (!empty($options['subdomain'])) {
1238 1238
             // Si nous ne correspondons pas au sous-domaine actuel, alors
1239 1239
             // nous n'avons pas besoin d'ajouter la route.
1240
-            if (! $this->checkSubdomains($options['subdomain'])) {
1240
+            if (!$this->checkSubdomains($options['subdomain'])) {
1241 1241
                 return;
1242 1242
             }
1243 1243
 
@@ -1268,7 +1268,7 @@  discard block
 block discarded – undo
1268 1268
         }
1269 1269
 
1270 1270
         // S'il s'agit d'une redirection, aucun traitement
1271
-        if (! isset($options['redirect']) && is_string($to)) {
1271
+        if (!isset($options['redirect']) && is_string($to)) {
1272 1272
             // Si aucun espace de noms n'est trouvé, ajouter l'espace de noms par défaut
1273 1273
             if (strpos($to, '\\') === false || strpos($to, '\\') > 0) {
1274 1274
                 $namespace = $options['namespace'] ?? $this->defaultNamespace;
@@ -1286,7 +1286,7 @@  discard block
 block discarded – undo
1286 1286
         // les routes manuelement définies doivent toujours être la "source de vérité".
1287 1287
         // cela ne fonctionne que parce que les routes découvertes sont ajoutées juste avant
1288 1288
         // pour tenter de router la requête.
1289
-        if (isset($this->routes[$verb][$name]) && ! $overwrite) {
1289
+        if (isset($this->routes[$verb][$name]) && !$overwrite) {
1290 1290
             return;
1291 1291
         }
1292 1292
 
@@ -1310,7 +1310,7 @@  discard block
 block discarded – undo
1310 1310
     private function checkHostname(string $hostname): bool
1311 1311
     {
1312 1312
         // Les appels CLI ne peuvent pas être sur le nom d'hôte.
1313
-        if (! isset($this->httpHost) || is_cli()) {
1313
+        if (!isset($this->httpHost) || is_cli()) {
1314 1314
             return false;
1315 1315
         }
1316 1316
 
@@ -1326,7 +1326,7 @@  discard block
 block discarded – undo
1326 1326
     private function checkSubdomains($subdomains): bool
1327 1327
     {
1328 1328
         // Les appels CLI ne peuvent pas être sur le sous-domaine.
1329
-        if (! isset($_SERVER['HTTP_HOST'])) {
1329
+        if (!isset($_SERVER['HTTP_HOST'])) {
1330 1330
             return false;
1331 1331
         }
1332 1332
 
@@ -1334,13 +1334,13 @@  discard block
 block discarded – undo
1334 1334
             $this->currentSubdomain = $this->determineCurrentSubdomain();
1335 1335
         }
1336 1336
 
1337
-        if (! is_array($subdomains)) {
1337
+        if (!is_array($subdomains)) {
1338 1338
             $subdomains = [$subdomains];
1339 1339
         }
1340 1340
 
1341 1341
         // Les routes peuvent être limitées à n'importe quel sous-domaine. Dans ce cas, cependant,
1342 1342
         // il nécessite la présence d'un sous-domaine.
1343
-        if (! empty($this->currentSubdomain) && in_array('*', $subdomains, true)) {
1343
+        if (!empty($this->currentSubdomain) && in_array('*', $subdomains, true)) {
1344 1344
             return true;
1345 1345
         }
1346 1346
 
@@ -1375,7 +1375,7 @@  discard block
 block discarded – undo
1375 1375
         }
1376 1376
 
1377 1377
         // Débarrassez-vous de tous les domaines, qui seront les derniers
1378
-        unset($host[count($host) -1]);
1378
+        unset($host[count($host) - 1]);
1379 1379
 
1380 1380
         // Compte pour les domaines .co.uk, .co.nz, etc.
1381 1381
         if (end($host) === 'co') {
@@ -1396,7 +1396,7 @@  discard block
 block discarded – undo
1396 1396
      */
1397 1397
     private function getControllerName(Closure|string $handler): ?string
1398 1398
     {
1399
-        if (! is_string($handler)) {
1399
+        if (!is_string($handler)) {
1400 1400
             return null;
1401 1401
         }
1402 1402
 
@@ -1461,7 +1461,7 @@  discard block
 block discarded – undo
1461 1461
 
1462 1462
         // Vérifier les paramètres régionaux non valides
1463 1463
         if ($locale !== null) {
1464
-            if (! in_array($locale, config('app.supported_locales'), true)) {
1464
+            if (!in_array($locale, config('app.supported_locales'), true)) {
1465 1465
                 $locale = null;
1466 1466
             }
1467 1467
         }
Please login to merge, or discard this patch.
src/Router/RouteBuilder.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -15,8 +15,8 @@
 block discarded – undo
15 15
  * @method $this setDefaultMethod(string $value) Définit la méthode par défaut pour appeler le contrôleur lorsqu'aucun autre méthode a été définie dans la route.
16 16
  * @method $this setTranslateURIDashes(bool $value) Indique au système s'il faut convertir les tirets des chaînes URI en traits de soulignement.
17 17
  * @method $this setAutoRoute(bool $value) Si TRUE, le système tentera de faire correspondre l'URI avec
18
-     * Contrôleurs en faisant correspondre chaque segment avec des dossiers/fichiers
19
-     * dans CONTROLLER_PATH, lorsqu'aucune correspondance n'a été trouvée pour les routes définies.
18
+ * Contrôleurs en faisant correspondre chaque segment avec des dossiers/fichiers
19
+ * dans CONTROLLER_PATH, lorsqu'aucune correspondance n'a été trouvée pour les routes définies.
20 20
  * @method $this set404Override($callable = null) Définit la classe/méthode qui doit être appelée si le routage ne trouver pas une correspondance.
21 21
  * @method $this setDefaultConstraint(string $placeholder) Définit la contrainte par défaut à utiliser dans le système. Typiquement à utiliser avec la méthode 'ressource'.
22 22
  * @method $this setPrioritize(bool $enabled = true) Activer ou désactiver le tri des routes par priorité
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -262,7 +262,7 @@
 block discarded – undo
262 262
      */
263 263
     private function attribute(string $key, $value): self
264 264
     {
265
-        if (! in_array($key, $this->allowedAttributes)) {
265
+        if (!in_array($key, $this->allowedAttributes)) {
266 266
             throw new InvalidArgumentException("L'attribute [{$key}] n'existe pas.");
267 267
         }
268 268
 
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.