Passed
Push — main ( aec17e...ff79ac )
by Dimitri
04:24
created
src/Router/RouteCollection.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
         // Incluez le fichier routesFile s'il n'existe pas.
264 264
         // Ne conserver que pour les fins BC pour l'instant.
265 265
         $routeFiles = $this->routeFiles;
266
-        if (! in_array($routesFile, $routeFiles, true)) {
266
+        if (!in_array($routesFile, $routeFiles, true)) {
267 267
             $routeFiles[] = $routesFile;
268 268
         }
269 269
 
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
         $routes = $this;
272 272
 
273 273
         foreach ($routeFiles as $routesFile) {
274
-            if (! is_file($routesFile)) {
274
+            if (!is_file($routesFile)) {
275 275
                 logger()->warning(sprintf('Fichier de route introuvable : "%s"', $routesFile));
276 276
 
277 277
                 continue;
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
      */
321 321
     public function placeholder(array|string $placeholder, ?string $pattern = null): self
322 322
     {
323
-        if (! is_array($placeholder)) {
323
+        if (!is_array($placeholder)) {
324 324
             $placeholder = [$placeholder => $pattern];
325 325
         }
326 326
 
@@ -1023,7 +1023,7 @@  discard block
 block discarded – undo
1023 1023
      *
1024 1024
      * @param array|Closure|string $to
1025 1025
      */
1026
-    public function match(array $verbs = [], string $from = '', $to = '', ?array $options = null): self
1026
+    public function match(array $verbs = [], string $from = '', $to = '', ?array $options = null) : self
1027 1027
     {
1028 1028
         if (empty($from) || empty($to)) {
1029 1029
             throw new InvalidArgumentException('Vous devez fournir les paramètres : $from, $to.');
@@ -1212,7 +1212,7 @@  discard block
 block discarded – undo
1212 1212
                 $from = $route['from'];
1213 1213
 
1214 1214
                 // on ignore les closures
1215
-                if (! is_string($to)) {
1215
+                if (!is_string($to)) {
1216 1216
                     continue;
1217 1217
                 }
1218 1218
 
@@ -1223,7 +1223,7 @@  discard block
 block discarded – undo
1223 1223
 
1224 1224
                 // S'il y a une chance de correspondance, alors ce sera
1225 1225
                 // soit avec $search au début de la chaîne $to.
1226
-                if (! str_starts_with($to, $search)) {
1226
+                if (!str_starts_with($to, $search)) {
1227 1227
                     continue;
1228 1228
                 }
1229 1229
 
@@ -1299,7 +1299,7 @@  discard block
 block discarded – undo
1299 1299
 
1300 1300
         // Construisez notre chaîne résultante, en insérant les $params aux endroits appropriés.
1301 1301
         foreach ($matches[0] as $index => $placeholder) {
1302
-            if (! isset($params[$index])) {
1302
+            if (!isset($params[$index])) {
1303 1303
                 throw new InvalidArgumentException(
1304 1304
                     'Argument manquant pour "' . $placeholder . '" dans la route "' . $from . '".'
1305 1305
                 );
@@ -1310,7 +1310,7 @@  discard block
 block discarded – undo
1310 1310
             // ou peut-être que $placeholder n'est pas un espace réservé, mais une regex.
1311 1311
             $pattern = $this->placeholders[$placeholderName] ?? $placeholder;
1312 1312
 
1313
-            if (! preg_match('#^' . $pattern . '$#u', $params[$index])) {
1313
+            if (!preg_match('#^' . $pattern . '$#u', $params[$index])) {
1314 1314
                 throw RouterException::invalidParameterType();
1315 1315
             }
1316 1316
 
@@ -1367,7 +1367,7 @@  discard block
 block discarded – undo
1367 1367
             $from = trim($from, '/');
1368 1368
         }
1369 1369
 
1370
-        if (is_string($to) && ! str_contains($to, '::') && class_exists($to) && method_exists($to, '__invoke')) {
1370
+        if (is_string($to) && !str_contains($to, '::') && class_exists($to) && method_exists($to, '__invoke')) {
1371 1371
             $to = [$to, '__invoke'];
1372 1372
         }
1373 1373
 
@@ -1379,7 +1379,7 @@  discard block
 block discarded – undo
1379 1379
         $options = array_merge($this->currentOptions ?? [], $options ?? []);
1380 1380
 
1381 1381
         if (isset($options['middleware'])) {
1382
-            if (! isset($options['middlewares'])) {
1382
+            if (!isset($options['middlewares'])) {
1383 1383
                 $options['middlewares'] = (array) $options['middleware'];
1384 1384
             }
1385 1385
             unset($options['middleware']);
@@ -1400,9 +1400,9 @@  discard block
 block discarded – undo
1400 1400
         }
1401 1401
 
1402 1402
         // Limitation du nom d'hôte ?
1403
-        if (! empty($options['hostname'])) {
1403
+        if (!empty($options['hostname'])) {
1404 1404
             // @todo déterminer s'il existe un moyen de mettre les hôtes sur liste blanche ?
1405
-            if (! $this->checkHostname($options['hostname'])) {
1405
+            if (!$this->checkHostname($options['hostname'])) {
1406 1406
                 return;
1407 1407
             }
1408 1408
 
@@ -1410,10 +1410,10 @@  discard block
 block discarded – undo
1410 1410
         }
1411 1411
 
1412 1412
         // Limitation du nom sous-domaine ?
1413
-        elseif (! empty($options['subdomain'])) {
1413
+        elseif (!empty($options['subdomain'])) {
1414 1414
             // Si nous ne correspondons pas au sous-domaine actuel, alors
1415 1415
             // nous n'avons pas besoin d'ajouter la route.
1416
-            if (! $this->checkSubdomains($options['subdomain'])) {
1416
+            if (!$this->checkSubdomains($options['subdomain'])) {
1417 1417
                 return;
1418 1418
             }
1419 1419
 
@@ -1446,9 +1446,9 @@  discard block
 block discarded – undo
1446 1446
         }
1447 1447
 
1448 1448
         // S'il s'agit d'une redirection, aucun traitement
1449
-        if (! isset($options['redirect']) && is_string($to)) {
1449
+        if (!isset($options['redirect']) && is_string($to)) {
1450 1450
             // Si aucun espace de noms n'est trouvé, ajouter l'espace de noms par défaut
1451
-            if (! str_contains($to, '\\') || strpos($to, '\\') > 0) {
1451
+            if (!str_contains($to, '\\') || strpos($to, '\\') > 0) {
1452 1452
                 $namespace = $options['namespace'] ?? $this->defaultNamespace;
1453 1453
                 $to        = trim($namespace, '\\') . '\\' . $to;
1454 1454
             }
@@ -1465,7 +1465,7 @@  discard block
 block discarded – undo
1465 1465
         // cela ne fonctionne que parce que les routes découvertes sont ajoutées juste avant
1466 1466
         // pour tenter de router la requête.
1467 1467
         $routeKeyExists = isset($this->routes[$verb][$routeKey]);
1468
-        if ((isset($this->routesNames[$verb][$name]) || $routeKeyExists) && ! $overwrite) {
1468
+        if ((isset($this->routesNames[$verb][$name]) || $routeKeyExists) && !$overwrite) {
1469 1469
             return;
1470 1470
         }
1471 1471
 
@@ -1491,7 +1491,7 @@  discard block
 block discarded – undo
1491 1491
     private function checkHostname(string $hostname): bool
1492 1492
     {
1493 1493
         // Les appels CLI ne peuvent pas être sur le nom d'hôte.
1494
-        if (! isset($this->httpHost)) {
1494
+        if (!isset($this->httpHost)) {
1495 1495
             return false;
1496 1496
         }
1497 1497
 
@@ -1507,7 +1507,7 @@  discard block
 block discarded – undo
1507 1507
     private function checkSubdomains($subdomains): bool
1508 1508
     {
1509 1509
         // Les appels CLI ne peuvent pas être sur le sous-domaine.
1510
-        if (! isset($this->httpHost)) {
1510
+        if (!isset($this->httpHost)) {
1511 1511
             return false;
1512 1512
         }
1513 1513
 
@@ -1515,13 +1515,13 @@  discard block
 block discarded – undo
1515 1515
             $this->currentSubdomain = $this->determineCurrentSubdomain();
1516 1516
         }
1517 1517
 
1518
-        if (! is_array($subdomains)) {
1518
+        if (!is_array($subdomains)) {
1519 1519
             $subdomains = [$subdomains];
1520 1520
         }
1521 1521
 
1522 1522
         // Les routes peuvent être limitées à n'importe quel sous-domaine. Dans ce cas, cependant,
1523 1523
         // il nécessite la présence d'un sous-domaine.
1524
-        if (! empty($this->currentSubdomain) && in_array('*', $subdomains, true)) {
1524
+        if (!empty($this->currentSubdomain) && in_array('*', $subdomains, true)) {
1525 1525
             return true;
1526 1526
         }
1527 1527
 
@@ -1543,7 +1543,7 @@  discard block
 block discarded – undo
1543 1543
         // sur l'URL sinon parse_url sera mal interprété
1544 1544
         // 'hôte' comme 'chemin'.
1545 1545
         $url = $this->httpHost;
1546
-        if (! str_starts_with($url, 'http')) {
1546
+        if (!str_starts_with($url, 'http')) {
1547 1547
             $url = 'http://' . $url;
1548 1548
         }
1549 1549
 
@@ -1584,7 +1584,7 @@  discard block
 block discarded – undo
1584 1584
 
1585 1585
     private function getControllerName(Closure|string $handler): ?string
1586 1586
     {
1587
-        if (! is_string($handler)) {
1587
+        if (!is_string($handler)) {
1588 1588
             return null;
1589 1589
         }
1590 1590
 
@@ -1643,13 +1643,13 @@  discard block
 block discarded – undo
1643 1643
      */
1644 1644
     private function replaceLocale(string $route, ?string $locale = null): string
1645 1645
     {
1646
-        if (! str_contains($route, '{locale}')) {
1646
+        if (!str_contains($route, '{locale}')) {
1647 1647
             return $route;
1648 1648
         }
1649 1649
 
1650 1650
         // Vérifier les paramètres régionaux non valides
1651 1651
         if ($locale !== null) {
1652
-            if (! in_array($locale, config('app.supported_locales'), true)) {
1652
+            if (!in_array($locale, config('app.supported_locales'), true)) {
1653 1653
                 $locale = null;
1654 1654
             }
1655 1655
         }
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/Helpers/url.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 
26 26
 // =================================  ================================= //
27 27
 
28
-if (! function_exists('site_url')) {
28
+if (!function_exists('site_url')) {
29 29
     /**
30 30
      * Renvoie une URL de site telle que définie par la configuration de l'application.
31 31
      *
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
     }
50 50
 }
51 51
 
52
-if (! function_exists('base_url')) {
52
+if (!function_exists('base_url')) {
53 53
     /**
54 54
      * Renvoie l'URL de base telle que définie par la configuration de l'application.
55 55
      * Les URL de base sont des URL de site coupées sans la page d'index.
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
     }
69 69
 }
70 70
 
71
-if (! function_exists('current_url')) {
71
+if (!function_exists('current_url')) {
72 72
     /**
73 73
      * Renvoie l'URL complète (y compris les segments) de la page où cette fonction est placée
74 74
      *
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
     }
96 96
 }
97 97
 
98
-if (! function_exists('previous_url')) {
98
+if (!function_exists('previous_url')) {
99 99
     /**
100 100
      * Renvoie l'URL précédente sur laquelle se trouvait le visiteur actuel. Pour des raisons de sécurité
101 101
      * nous vérifions d'abord une variable de session enregistrée, si elle existe, et l'utilisons.
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
     }
116 116
 }
117 117
 
118
-if (! function_exists('uri_string')) {
118
+if (!function_exists('uri_string')) {
119 119
     /**
120 120
      * Renvoie la partie chemin de l'URL actuelle
121 121
      *
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
     }
130 130
 }
131 131
 
132
-if (! function_exists('index_page')) {
132
+if (!function_exists('index_page')) {
133 133
     /**
134 134
      * Renvoie la "index_page" de votre fichier de configuration
135 135
      */
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
     }
140 140
 }
141 141
 
142
-if (! function_exists('anchor')) {
142
+if (!function_exists('anchor')) {
143 143
     /**
144 144
      * Crée une ancre basée sur l'URL locale.
145 145
      *
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
     }
165 165
 }
166 166
 
167
-if (! function_exists('anchor_popup')) {
167
+if (!function_exists('anchor_popup')) {
168 168
     /**
169 169
      * Lien d'ancrage - Version contextuelle
170 170
      *
@@ -187,12 +187,12 @@  discard block
 block discarded – undo
187 187
             return '<a href="' . $siteUrl . '" onclick="window.open(\'' . $siteUrl . "', '_blank'); return false;\">" . $title . '</a>';
188 188
         }
189 189
 
190
-        if (! is_array($attributes)) {
190
+        if (!is_array($attributes)) {
191 191
             $attributes = [$attributes];
192 192
 
193 193
             // Ref: http://www.w3schools.com/jsref/met_win_open.asp
194 194
             $windowName = '_blank';
195
-        } elseif (! empty($attributes['window_name'])) {
195
+        } elseif (!empty($attributes['window_name'])) {
196 196
             $windowName = $attributes['window_name'];
197 197
             unset($attributes['window_name']);
198 198
         } else {
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
     }
213 213
 }
214 214
 
215
-if (! function_exists('mailto')) {
215
+if (!function_exists('mailto')) {
216 216
     /**
217 217
      * Lien Mailto
218 218
      *
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
     }
230 230
 }
231 231
 
232
-if (! function_exists('safe_mailto')) {
232
+if (!function_exists('safe_mailto')) {
233 233
     /**
234 234
      * Lien Mailto codé
235 235
      *
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
     }
321 321
 }
322 322
 
323
-if (! function_exists('auto_link')) {
323
+if (!function_exists('auto_link')) {
324 324
     /**
325 325
      * Lien automatique
326 326
      *
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
     function auto_link(string $str, string $type = 'both', bool $popup = false): string
336 336
     {
337 337
         // Recherche et remplace tous les URLs.
338
-        if ($type !== 'email' && preg_match_all('#(\w*://|www\.)[^\s()<>;]+\w#i', $str, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER)) {
338
+        if ($type !== 'email' && preg_match_all('#(\w*://|www\.)[^\s()<>;]+\w#i', $str, $matches, PREG_OFFSET_CAPTURE|PREG_SET_ORDER)) {
339 339
             // Définissez notre HTML cible si vous utilisez des liens contextuels.
340 340
             $target = ($popup) ? ' target="_blank"' : '';
341 341
 
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
     }
367 367
 }
368 368
 
369
-if (! function_exists('prep_url')) {
369
+if (!function_exists('prep_url')) {
370 370
     /**
371 371
      * Ajoute simplement la partie http:// ou https:// si aucun schéma n'est inclus.
372 372
      *
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
     }
392 392
 }
393 393
 
394
-if (! function_exists('url_title')) {
394
+if (!function_exists('url_title')) {
395 395
     /**
396 396
      * Créer un titre d'URL
397 397
      *
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
     }
428 428
 }
429 429
 
430
-if (! function_exists('mb_url_title')) {
430
+if (!function_exists('mb_url_title')) {
431 431
     /**
432 432
      * Créer un titre d'URL qui prend en compte les caractères accentués
433 433
      *
@@ -446,7 +446,7 @@  discard block
 block discarded – undo
446 446
     }
447 447
 }
448 448
 
449
-if (! function_exists('url_to')) {
449
+if (!function_exists('url_to')) {
450 450
     /**
451 451
      * Obtenir l'URL complète et absolue d'une méthode de contrôleur
452 452
      * (avec arguments supplémentaires)
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
      */
460 460
     function url_to(string $controller, ...$args): string
461 461
     {
462
-        if (! $route = route($controller, ...$args)) {
462
+        if (!$route = route($controller, ...$args)) {
463 463
             $explode = explode('::', $controller);
464 464
 
465 465
             if (isset($explode[1])) {
@@ -473,7 +473,7 @@  discard block
 block discarded – undo
473 473
     }
474 474
 }
475 475
 
476
-if (! function_exists('route')) {
476
+if (!function_exists('route')) {
477 477
     /**
478 478
      * Tente de rechercher une route en fonction de sa destination.
479 479
      *
@@ -485,7 +485,7 @@  discard block
 block discarded – undo
485 485
     }
486 486
 }
487 487
 
488
-if (! function_exists('url_is')) {
488
+if (!function_exists('url_is')) {
489 489
     /**
490 490
      * Détermine si le chemin d'URL actuel contient le chemin donné.
491 491
      * Il peut contenir un caractère générique (*) qui autorisera tout caractère valide.
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
     }
504 504
 }
505 505
 
506
-if (! function_exists('link_active')) {
506
+if (!function_exists('link_active')) {
507 507
     /**
508 508
      * Lien actif dans la navbar
509 509
      * Un peut comme le router-active-link de vuejs
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
             return $active_class;
528 528
         }
529 529
 
530
-        if (! $exact && preg_match('#^' . $path . '/?#i', $current_section)) {
530
+        if (!$exact && preg_match('#^' . $path . '/?#i', $current_section)) {
531 531
             return $active_class;
532 532
         }
533 533
 
@@ -539,14 +539,14 @@  discard block
 block discarded – undo
539 539
     }
540 540
 }
541 541
 
542
-if (! function_exists('clean_url')) {
542
+if (!function_exists('clean_url')) {
543 543
     function clean_url(string $url): string
544 544
     {
545 545
         return Helpers::cleanUrl($url);
546 546
     }
547 547
 }
548 548
 
549
-if (! function_exists('is_absolute_link')) {
549
+if (!function_exists('is_absolute_link')) {
550 550
     /**
551 551
      * Verifies si un chemin donnée est une url absolue ou relative
552 552
      */
Please login to merge, or discard this patch.
src/View/View.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 
157 157
         $this->adapter->addData($data, $context);
158 158
 
159
-        if (! array_key_exists('errors', $this->getData())) {
159
+        if (!array_key_exists('errors', $this->getData())) {
160 160
             $this->setValidationErrors();
161 161
         }
162 162
 
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
         if (is_string($errors)) {
186 186
             $errors = ['default' => $errors];
187 187
         }
188
-        if (! ($errors instanceof ErrorBag)) {
188
+        if (!($errors instanceof ErrorBag)) {
189 189
             $errors = new ErrorBag($errors);
190 190
         }
191 191
 
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 
226 226
         $this->adapter->setData($data, $context);
227 227
 
228
-        if (! array_key_exists('errors', $this->getData())) {
228
+        if (!array_key_exists('errors', $this->getData())) {
229 229
             $this->setValidationErrors();
230 230
         }
231 231
 
@@ -265,10 +265,10 @@  discard block
 block discarded – undo
265 265
      */
266 266
     public function setAdapter(string $adapter, array $config = []): self
267 267
     {
268
-        if (! array_key_exists($adapter, self::$validAdapters)) {
268
+        if (!array_key_exists($adapter, self::$validAdapters)) {
269 269
             $adapter = 'native';
270 270
         }
271
-        if (empty($this->config['adapters']) || ! is_array($this->config['adapters'])) {
271
+        if (empty($this->config['adapters']) || !is_array($this->config['adapters'])) {
272 272
             $this->config['adapters'] = [];
273 273
         }
274 274
 
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
     protected function decorate(string $output): string
326 326
     {
327 327
         foreach ($this->config['decorators'] as $decorator) {
328
-            if (! is_subclass_of($decorator, ViewDecoratorInterface::class)) {
328
+            if (!is_subclass_of($decorator, ViewDecoratorInterface::class)) {
329 329
                 throw ViewException::invalidDecorator($decorator);
330 330
             }
331 331
 
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/Controllers/ApplicationController.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
         $options = (array) $options;
46 46
 
47 47
         // N'est-il pas namespaced ? on cherche le dossier en fonction du controleur
48
-        if (! str_contains($view, '\\')) {
48
+        if (!str_contains($view, '\\')) {
49 49
             $reflection                                      = new ReflectionClass(static::class);
50 50
             ['dirname' => $dirname, 'filename' => $filename] = pathinfo($reflection->getFileName());
51 51
             $dirname                                         = str_ireplace('Controllers', 'Views', $dirname);
@@ -57,16 +57,16 @@  discard block
 block discarded – undo
57 57
 
58 58
         $viewer->setData($data)->setOptions($options);
59 59
 
60
-        if (! empty($this->layout) && is_string($this->layout)) {
60
+        if (!empty($this->layout) && is_string($this->layout)) {
61 61
             $viewer->setLayout($this->layout);
62 62
         }
63 63
 
64
-        if (! empty($this->viewDatas) && is_array($this->viewDatas)) {
64
+        if (!empty($this->viewDatas) && is_array($this->viewDatas)) {
65 65
             $viewer->addData($this->viewDatas);
66 66
         }
67 67
 
68 68
         if (empty($data['title'])) {
69
-            if (! is_string($controllerName = Dispatcher::getController(false))) {
69
+            if (!is_string($controllerName = Dispatcher::getController(false))) {
70 70
                 $controllerName = static::class;
71 71
             }
72 72
             $controllerName = str_ireplace(['App\Controllers', 'Controller'], '', $controllerName);
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.