Passed
Push — main ( 633b92...66245a )
by Dimitri
12:27
created
src/Loader/Load.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -39,16 +39,16 @@  discard block
 block discarded – undo
39 39
 
40 40
         // services système
41 41
         $filename = SYST_PATH . 'Constants' . DS . 'providers.php';
42
-        if (! file_exists($filename)) {
42
+        if (!file_exists($filename)) {
43 43
             throw LoadException::providersDefinitionDontExist($filename);
44 44
         }
45
-        if (! in_array($filename, get_included_files(), true)) {
45
+        if (!in_array($filename, get_included_files(), true)) {
46 46
             $providers = array_merge($providers, require $filename);
47 47
         }
48 48
 
49 49
         // services de l'application
50 50
         $filename = CONFIG_PATH . 'providers.php';
51
-        if (file_exists($filename) && ! in_array($filename, get_included_files(), true)) {
51
+        if (file_exists($filename) && !in_array($filename, get_included_files(), true)) {
52 52
             $providers = array_merge($providers, require $filename);
53 53
         }
54 54
 
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
             return $models;
98 98
         }
99 99
 
100
-        if (! self::isLoaded('models', $model)) {
100
+        if (!self::isLoaded('models', $model)) {
101 101
             self::loaded('models', $model, FileLocator::model($model, $options, $connection));
102 102
         }
103 103
 
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
     {
112 112
         $locale ??= config('app.language');
113 113
 
114
-        if (! self::isLoaded('langs', $file . $locale)) {
114
+        if (!self::isLoaded('langs', $file . $locale)) {
115 115
             self::loaded('langs', $file . $locale, FileLocator::lang($file, $locale));
116 116
         }
117 117
 
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
      */
126 126
     private static function isLoaded(string $module, $element): bool
127 127
     {
128
-        if (! isset(self::$loads[$module]) || ! is_array(self::$loads[$module])) {
128
+        if (!isset(self::$loads[$module]) || !is_array(self::$loads[$module])) {
129 129
             return false;
130 130
         }
131 131
 
Please login to merge, or discard this patch.
src/Controllers/BaseController.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 
92 92
         $this->getModel();
93 93
 
94
-        if (! empty($this->helpers)) {
94
+        if (!empty($this->helpers)) {
95 95
             helper($this->helpers);
96 96
         }
97 97
     }
@@ -109,11 +109,11 @@  discard block
 block discarded – undo
109 109
             $this->modelName = is_object($which) ? null : $which;
110 110
         }
111 111
 
112
-        if (empty($this->model) && ! empty($this->modelName) && class_exists($this->modelName)) {
112
+        if (empty($this->model) && !empty($this->modelName) && class_exists($this->modelName)) {
113 113
             $this->model = model($this->modelName);
114 114
         }
115 115
 
116
-        if (! empty($this->model) && empty($this->modelName)) {
116
+        if (!empty($this->model) && empty($this->modelName)) {
117 117
             $this->modelName = get_class($this->model);
118 118
         }
119 119
     }
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
      */
152 152
     private function getModel()
153 153
     {
154
-        if (! empty($this->modelName)) {
154
+        if (!empty($this->modelName)) {
155 155
             $model = $this->modelName;
156 156
         } else {
157 157
             $model = str_replace('Controller', 'Model', static::class);
Please login to merge, or discard this patch.
src/Middlewares/BodyParser.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -152,19 +152,19 @@
 block discarded – undo
152 152
      */
153 153
     public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
154 154
     {
155
-        if (! in_array($request->getMethod(), $this->methods, true)) {
155
+        if (!in_array($request->getMethod(), $this->methods, true)) {
156 156
             return $handler->handle($request);
157 157
         }
158 158
 
159 159
         [$type] = explode(';', $request->getHeaderLine('Content-Type'));
160 160
         $type   = strtolower($type);
161
-        if (! isset($this->parsers[$type])) {
161
+        if (!isset($this->parsers[$type])) {
162 162
             return $handler->handle($request);
163 163
         }
164 164
 
165 165
         $parser = $this->parsers[$type];
166 166
         $result = $parser($request->getBody()->getContents());
167
-        if (! is_array($result)) {
167
+        if (!is_array($result)) {
168 168
             throw HttpException::badRequest();
169 169
         }
170 170
         $request = $request->withParsedBody($result);
Please login to merge, or discard this patch.
src/Router/Dispatcher.php 1 patch
Spacing   +18 added lines, -18 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
 
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
                 require_once $routes_file;
273 273
             }
274 274
         }
275
-        if (empty($routes) || ! ($routes instanceof RouteCollection)) {
275
+        if (empty($routes) || !($routes instanceof RouteCollection)) {
276 276
             $routes = Services::routes();
277 277
         }
278 278
 
@@ -282,14 +282,14 @@  discard block
 block discarded – undo
282 282
         $routeMiddlewares = (array) $this->dispatchRoutes($routes);
283 283
 
284 284
         // The bootstrapping in a middleware
285
-        $this->middleware->append(function (ServerRequestInterface $request, ResponseInterface $response, callable $next): ResponseInterface {
285
+        $this->middleware->append(function(ServerRequestInterface $request, ResponseInterface $response, callable $next): ResponseInterface {
286 286
             $returned = $this->startController($request, $response);
287 287
 
288 288
             // Closure controller has run in startController().
289
-            if (! is_callable($this->controller)) {
289
+            if (!is_callable($this->controller)) {
290 290
                 $controller = $this->createController($request, $response);
291 291
 
292
-                if (! method_exists($controller, '_remap') && ! is_callable([$controller, $this->method], false)) {
292
+                if (!method_exists($controller, '_remap') && !is_callable([$controller, $this->method], false)) {
293 293
                     throw PageNotFoundException::methodNotFound($this->method);
294 294
                 }
295 295
 
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
          */
328 328
         $this->gatherOutput($this->middleware->handle($this->request));
329 329
 
330
-        if (! $returnResponse) {
330
+        if (!$returnResponse) {
331 331
             $this->sendResponse();
332 332
         }
333 333
 
@@ -375,14 +375,14 @@  discard block
 block discarded – undo
375 375
             return;
376 376
         }
377 377
 
378
-        if (is_cli() && ! on_test()) {
378
+        if (is_cli() && !on_test()) {
379 379
             // @codeCoverageIgnoreStart
380 380
             // $this->request = Services::clirequest($this->config);
381 381
             // @codeCoverageIgnoreEnd
382 382
         }
383 383
 
384 384
         $version = $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.1';
385
-        if (! is_numeric($version)) {
385
+        if (!is_numeric($version)) {
386 386
             $version = substr($version, strpos($version, '/') + 1);
387 387
         }
388 388
 
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
         // Supposons le succès jusqu'à preuve du contraire.
402 402
         $this->response = Services::response()->withStatus(200);
403 403
 
404
-        if (! is_cli() || on_test()) {
404
+        if (!is_cli() || on_test()) {
405 405
         }
406 406
 
407 407
         $this->response = $this->response->withProtocolVersion($this->request->getProtocolVersion());
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
     {
438 438
         if ($cachedResponse = Services::cache()->read($this->generateCacheName())) {
439 439
             $cachedResponse = unserialize($cachedResponse);
440
-            if (! is_array($cachedResponse) || ! isset($cachedResponse['output']) || ! isset($cachedResponse['headers'])) {
440
+            if (!is_array($cachedResponse) || !isset($cachedResponse['output']) || !isset($cachedResponse['headers'])) {
441 441
                 throw new FrameworkException('Error unserializing page cache');
442 442
             }
443 443
 
@@ -566,7 +566,7 @@  discard block
 block discarded – undo
566 566
      */
567 567
     protected function determinePath(): string
568 568
     {
569
-        if (! empty($this->path)) {
569
+        if (!empty($this->path)) {
570 570
             return $this->path;
571 571
         }
572 572
 
@@ -618,7 +618,7 @@  discard block
 block discarded – undo
618 618
         }
619 619
 
620 620
         // Essayez de charger automatiquement la classe
621
-        if (! class_exists($this->controller, true) || $this->method[0] === '_') {
621
+        if (!class_exists($this->controller, true) || $this->method[0] === '_') {
622 622
             throw PageNotFoundException::controllerNotFound($this->controller, $this->method);
623 623
         }
624 624
 
@@ -706,7 +706,7 @@  discard block
 block discarded – undo
706 706
         // Affiche l'erreur 404
707 707
         $this->response = $this->response->withStatus($e->getCode());
708 708
 
709
-        if (! on_test()) {
709
+        if (!on_test()) {
710 710
             // @codeCoverageIgnoreStart
711 711
             if (ob_get_level() > 0) {
712 712
                 ob_end_flush();
@@ -718,7 +718,7 @@  discard block
 block discarded – undo
718 718
             ob_end_flush(); // @codeCoverageIgnore
719 719
         }
720 720
 
721
-        throw PageNotFoundException::pageNotFound(! on_prod() || is_cli() ? $e->getMessage() : '');
721
+        throw PageNotFoundException::pageNotFound(!on_prod() || is_cli() ? $e->getMessage() : '');
722 722
     }
723 723
 
724 724
     /**
@@ -773,7 +773,7 @@  discard block
 block discarded – undo
773 773
     public function storePreviousURL($uri)
774 774
     {
775 775
         // Ignorer les requêtes CLI
776
-        if (is_cli() && ! on_test()) {
776
+        if (is_cli() && !on_test()) {
777 777
             return; // @codeCoverageIgnore
778 778
         }
779 779
 
@@ -837,7 +837,7 @@  discard block
 block discarded – undo
837 837
         $this->middleware->prepend($this->spoofRequestMethod());
838 838
 
839 839
         $middlewaresFile = CONFIG_PATH . 'middlewares.php';
840
-        if (file_exists($middlewaresFile) && ! in_array($middlewaresFile, get_included_files(), true)) {
840
+        if (file_exists($middlewaresFile) && !in_array($middlewaresFile, get_included_files(), true)) {
841 841
             $middleware = require $middlewaresFile;
842 842
             if (is_callable($middleware)) {
843 843
                 $middlewareQueue = $middleware($this->middleware, $this->request);
@@ -854,11 +854,11 @@  discard block
 block discarded – undo
854 854
      */
855 855
     private function spoofRequestMethod(): callable
856 856
     {
857
-        return static function (ServerRequestInterface $request, ResponseInterface $response, callable $next) {
857
+        return static function(ServerRequestInterface $request, ResponseInterface $response, callable $next) {
858 858
             $post = $request->getParsedBody();
859 859
 
860 860
             // Ne fonctionne qu'avec les formulaires POST
861
-            if (strtoupper($request->getMethod()) === 'POST' && ! empty($post['_method'])) {
861
+            if (strtoupper($request->getMethod()) === 'POST' && !empty($post['_method'])) {
862 862
                 // Accepte seulement PUT, PATCH, DELETE
863 863
                 if (in_array(strtoupper($post['_method']), ['PUT', 'PATCH', 'DELETE'], true)) {
864 864
                     $request = $request->withMethod($post['_method']);
Please login to merge, or discard this patch.
src/Core/Database.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -63,12 +63,12 @@
 block discarded – undo
63 63
                 $group = on_test() ? 'test' : (on_prod() ? 'production' : 'development');
64 64
             }
65 65
 
66
-            if (! isset($config[$group])) {
66
+            if (!isset($config[$group])) {
67 67
                 $group = 'default';
68 68
             }
69 69
         }
70 70
 
71
-        if (is_string($group) && ! isset($config[$group]) && strpos($group, 'custom-') !== 0) {
71
+        if (is_string($group) && !isset($config[$group]) && strpos($group, 'custom-') !== 0) {
72 72
             throw new InvalidArgumentException($group . ' is not a valid database connection group.');
73 73
         }
74 74
 
Please login to merge, or discard this patch.
src/Models/BaseModel.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -197,7 +197,7 @@
 block discarded – undo
197 197
         $table = empty($table) ? $this->table : $table;
198 198
 
199 199
         // S'assurer qu'on a une bonne connxion a la base de donnees
200
-        if (! $this->db instanceof ConnectionInterface) {
200
+        if (!$this->db instanceof ConnectionInterface) {
201 201
             $this->db = Database::connect($this->group);
202 202
         }
203 203
 
Please login to merge, or discard this patch.
src/Helpers/common.php 1 patch
Spacing   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 
23 23
 // ================================= FONCTIONS D'ACCESSIBILITE ================================= //
24 24
 
25
-if (! function_exists('env')) {
25
+if (!function_exists('env')) {
26 26
     /**
27 27
      * Obtient une variable d'environnement à partir des sources disponibles et fournit une émulation
28 28
      * pour les variables d'environnement non prises en charge ou incohérentes
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
     }
39 39
 }
40 40
 
41
-if (! function_exists('helper')) {
41
+if (!function_exists('helper')) {
42 42
     /**
43 43
      * Charge un fichier d'aide en mémoire. Prend en charge les assistants d'espace de noms,
44 44
      * à la fois dans et hors du répertoire 'helpers' d'un répertoire à espace de noms.
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
     }
57 57
 }
58 58
 
59
-if (! function_exists('model')) {
59
+if (!function_exists('model')) {
60 60
     /**
61 61
      * Simple maniere d'obtenir un modele.
62 62
      *
@@ -66,13 +66,13 @@  discard block
 block discarded – undo
66 66
      *
67 67
      * @return T
68 68
      */
69
-    function model(string|array $name, array $options = [], ?ConnectionInterface &$conn = null)
69
+    function model(string|array $name, array $options = [], ?ConnectionInterface&$conn = null)
70 70
     {
71 71
         return Load::model($name, $options, $conn);
72 72
     }
73 73
 }
74 74
 
75
-if (! function_exists('service')) {
75
+if (!function_exists('service')) {
76 76
     /**
77 77
      * Permet un accès plus propre au fichier de configuration des services.
78 78
      * Renvoie toujours une instance SHARED de la classe, donc
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
     }
90 90
 }
91 91
 
92
-if (! function_exists('single_service')) {
92
+if (!function_exists('single_service')) {
93 93
     /**
94 94
      * Autoriser l'accès propre à un service.
95 95
      * Renvoie toujours une nouvelle instance de la classe.
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
     }
104 104
 }
105 105
 
106
-if (! function_exists('show404')) {
106
+if (!function_exists('show404')) {
107 107
     /**
108 108
      * Afficher une page 404 introuvable dans le navigateur
109 109
      */
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
     }
114 114
 }
115 115
 
116
-if (! function_exists('config')) {
116
+if (!function_exists('config')) {
117 117
     /**
118 118
      * GET/SET App config
119 119
      *
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
      */
124 124
     function config(string $config, $value = null, bool $force_set = false)
125 125
     {
126
-        if (! empty($value) || (empty($value) && true === $force_set)) {
126
+        if (!empty($value) || (empty($value) && true === $force_set)) {
127 127
             Config::set($config, $value);
128 128
         }
129 129
 
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 
134 134
 // =========================== FONCTIONS DE PREVENTION D'ATTAQUE =========================== //
135 135
 
136
-if (! function_exists('esc')) {
136
+if (!function_exists('esc')) {
137 137
     /**
138 138
      * Effectue un simple échappement automatique des données pour des raisons de sécurité.
139 139
      * Pourrait envisager de rendre cela plus complexe à une date ultérieure.
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
     }
161 161
 }
162 162
 
163
-if (! function_exists('h')) {
163
+if (!function_exists('h')) {
164 164
     /**
165 165
      * Méthode pratique pour htmlspecialchars.
166 166
      *
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
     }
180 180
 }
181 181
 
182
-if (! function_exists('purify')) {
182
+if (!function_exists('purify')) {
183 183
     /**
184 184
      * Purifiez l'entrée à l'aide de la classe autonome HTMLPurifier.
185 185
      * Utilisez facilement plusieurs configurations de purificateur.
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
     }
198 198
 }
199 199
 
200
-if (! function_exists('remove_invisible_characters')) {
200
+if (!function_exists('remove_invisible_characters')) {
201 201
     /**
202 202
      * Supprimer les caractères invisibles
203 203
      *
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
     }
211 211
 }
212 212
 
213
-if (! function_exists('stringify_attributes')) {
213
+if (!function_exists('stringify_attributes')) {
214 214
     /**
215 215
      * Chaîner les attributs à utiliser dans les balises HTML.
216 216
      *
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 
225 225
 // ================================= FONCTIONS D'ENVIRONNEMENT D'EXECUTION ================================= //
226 226
 
227
-if (! function_exists('on_dev')) {
227
+if (!function_exists('on_dev')) {
228 228
     /**
229 229
      * Testez pour voir si nous sommes dans un environnement de développement.
230 230
      */
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
     }
241 241
 }
242 242
 
243
-if (! function_exists('on_prod')) {
243
+if (!function_exists('on_prod')) {
244 244
     /**
245 245
      * Testez pour voir si nous sommes dans un environnement de production.
246 246
      */
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
     }
257 257
 }
258 258
 
259
-if (! function_exists('on_test')) {
259
+if (!function_exists('on_test')) {
260 260
     /**
261 261
      * Testez pour voir si nous sommes dans un environnement de test
262 262
      */
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
     }
269 269
 }
270 270
 
271
-if (! function_exists('is_cli')) {
271
+if (!function_exists('is_cli')) {
272 272
     /**
273 273
      * Testez pour voir si une demande a été faite à partir de la ligne de commande.
274 274
      */
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
     }
279 279
 }
280 280
 
281
-if (! function_exists('is_php')) {
281
+if (!function_exists('is_php')) {
282 282
     /**
283 283
      * Détermine si la version actuelle de PHP est égale ou supérieure à la valeur fournie.
284 284
      */
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
     }
289 289
 }
290 290
 
291
-if (! function_exists('is_windows')) {
291
+if (!function_exists('is_windows')) {
292 292
     /**
293 293
      * Déterminez si l'environnement actuel est basé sur Windows.
294 294
      */
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
     }
299 299
 }
300 300
 
301
-if (! function_exists('is_https')) {
301
+if (!function_exists('is_https')) {
302 302
     /**
303 303
      * Determines if the application is accessed via an encrypted * (HTTPS) connection.
304 304
      */
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
     }
309 309
 }
310 310
 
311
-if (! function_exists('is_localfile')) {
311
+if (!function_exists('is_localfile')) {
312 312
     /**
313 313
      * Vérifiez si le fichier auquel vous souhaitez accéder est un fichier local de votre application ou non
314 314
      */
@@ -318,11 +318,11 @@  discard block
 block discarded – undo
318 318
             return true;
319 319
         }
320 320
 
321
-        return ! preg_match('#^(https?://)#i', $name);
321
+        return !preg_match('#^(https?://)#i', $name);
322 322
     }
323 323
 }
324 324
 
325
-if (! function_exists('is_online')) {
325
+if (!function_exists('is_online')) {
326 326
     /**
327 327
      * Tester si l'application s'exécute en local ou en ligne.
328 328
      */
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
     }
333 333
 }
334 334
 
335
-if (! function_exists('is_ajax_request')) {
335
+if (!function_exists('is_ajax_request')) {
336 336
     /**
337 337
      * Testez pour voir si une requête contient l'en-tête HTTP_X_REQUESTED_WITH.
338 338
      */
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
     }
343 343
 }
344 344
 
345
-if (! function_exists('redirection')) {
345
+if (!function_exists('redirection')) {
346 346
     /**
347 347
      * Redirige l'utilisateur
348 348
      */
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
     }
357 357
 }
358 358
 
359
-if (! function_exists('redirect')) {
359
+if (!function_exists('redirect')) {
360 360
     /**
361 361
      * Méthode pratique qui fonctionne avec la $request globale actuelle et
362 362
      * l'instance $router à rediriger à l'aide de routes nommées et le routage inversé
@@ -370,7 +370,7 @@  discard block
 block discarded – undo
370 370
     {
371 371
         $redirection = Services::redirection();
372 372
 
373
-        if (! empty($uri)) {
373
+        if (!empty($uri)) {
374 374
             return $redirection->route($uri);
375 375
         }
376 376
 
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
     }
379 379
 }
380 380
 
381
-if (! function_exists('link_to')) {
381
+if (!function_exists('link_to')) {
382 382
     /**
383 383
      * Étant donné une chaîne de contrôleur/méthode et tous les paramètres,
384 384
      * tentera de créer l'URL relative à la route correspondante.
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
     }
395 395
 }
396 396
 
397
-if (! function_exists('clean_path')) {
397
+if (!function_exists('clean_path')) {
398 398
     /**
399 399
      * Une méthode pratique pour nettoyer les chemins pour
400 400
      * une sortie plus belle. Utile pour les exceptions
@@ -425,7 +425,7 @@  discard block
 block discarded – undo
425 425
 
426 426
 // ================================= FONCTIONS DE DEBOGAGE ================================= //
427 427
 
428
-if (! function_exists('dd')) {
428
+if (!function_exists('dd')) {
429 429
     /**
430 430
      * Prints a Kint debug report and exits.
431 431
      *
@@ -444,7 +444,7 @@  discard block
 block discarded – undo
444 444
     }
445 445
 }
446 446
 
447
-if (! function_exists('dump')) {
447
+if (!function_exists('dump')) {
448 448
     /**
449 449
      * Prints a Kint debug report and exits.
450 450
      *
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
     }
462 462
 }
463 463
 
464
-if (! function_exists('deprecationWarning')) {
464
+if (!function_exists('deprecationWarning')) {
465 465
     /**
466 466
      * Méthode d'assistance pour générer des avertissements d'obsolescence
467 467
      *
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
     }
478 478
 }
479 479
 
480
-if (! function_exists('logger')) {
480
+if (!function_exists('logger')) {
481 481
     /**
482 482
      * A convenience/compatibility method for logging events through
483 483
      * the Log system.
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
500 500
     {
501 501
         $logger = Services::logger();
502 502
 
503
-        if (! empty($level) && ! empty($message)) {
503
+        if (!empty($level) && !empty($message)) {
504 504
             return $logger->log($level, $message, $context);
505 505
         }
506 506
 
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
     }
509 509
 }
510 510
 
511
-if (! function_exists('cache')) {
511
+if (!function_exists('cache')) {
512 512
     /**
513 513
      * Une méthode pratique qui donne accès au cache
514 514
      * objet. Si aucun paramètre n'est fourni, renverra l'objet,
@@ -538,7 +538,7 @@  discard block
 block discarded – undo
538 538
     }
539 539
 }
540 540
 
541
-if (! function_exists('pr')) {
541
+if (!function_exists('pr')) {
542 542
     /**
543 543
      * print_r() convenience function.
544 544
      *
@@ -560,7 +560,7 @@  discard block
 block discarded – undo
560 560
     }
561 561
 }
562 562
 
563
-if (! function_exists('pj')) {
563
+if (!function_exists('pj')) {
564 564
     /**
565 565
      * json pretty print convenience function.
566 566
      *
@@ -581,7 +581,7 @@  discard block
 block discarded – undo
581 581
     }
582 582
 }
583 583
 
584
-if (! function_exists('trigger_warning')) {
584
+if (!function_exists('trigger_warning')) {
585 585
     /**
586 586
      * Déclenche un E_USER_WARNING.
587 587
      */
@@ -591,7 +591,7 @@  discard block
 block discarded – undo
591 591
     }
592 592
 }
593 593
 
594
-if (! function_exists('vd')) {
594
+if (!function_exists('vd')) {
595 595
     /**
596 596
      * Shortcut to ref, HTML mode
597 597
      *
@@ -603,7 +603,7 @@  discard block
 block discarded – undo
603 603
     }
604 604
 }
605 605
 
606
-if (! function_exists('vdt')) {
606
+if (!function_exists('vdt')) {
607 607
     /**
608 608
      * Shortcut to ref, plain text mode
609 609
      *
@@ -617,7 +617,7 @@  discard block
 block discarded – undo
617 617
 
618 618
 // ================================= FONCTIONS DIVERSES ================================= //
619 619
 
620
-if (! function_exists('force_https')) {
620
+if (!function_exists('force_https')) {
621 621
     /**
622 622
      * Utilisé pour forcer l'accès à une page via HTTPS.
623 623
      * Utilise une redirection standard, plus définira l'en-tête HSTS
@@ -675,7 +675,7 @@  discard block
 block discarded – undo
675 675
     }
676 676
 }
677 677
 
678
-if (! function_exists('getTypeName')) {
678
+if (!function_exists('getTypeName')) {
679 679
     /**
680 680
      * Renvoie la classe d'objets ou le type var de ce n'est pas un objet
681 681
      *
@@ -689,7 +689,7 @@  discard block
 block discarded – undo
689 689
     }
690 690
 }
691 691
 
692
-if (! function_exists('ip_address')) {
692
+if (!function_exists('ip_address')) {
693 693
     /**
694 694
      * Renvoie l'adresse IP de l'utilisateur actuel
695 695
      */
@@ -699,7 +699,7 @@  discard block
 block discarded – undo
699 699
     }
700 700
 }
701 701
 
702
-if (! function_exists('is_really_writable')) {
702
+if (!function_exists('is_really_writable')) {
703 703
     /**
704 704
      * Tests d'inscriptibilité des fichiers
705 705
      */
@@ -710,7 +710,7 @@  discard block
 block discarded – undo
710 710
     }
711 711
 }
712 712
 
713
-if (! function_exists('lang')) {
713
+if (!function_exists('lang')) {
714 714
     /**
715 715
      * Une méthode pratique pour traduire une chaîne ou un tableau d'entrées et formater
716 716
      * le résultat avec le MessageFormatter de l'extension intl.
@@ -726,7 +726,7 @@  discard block
 block discarded – undo
726 726
     }
727 727
 }
728 728
 
729
-if (! function_exists('namespaceSplit')) {
729
+if (!function_exists('namespaceSplit')) {
730 730
     /**
731 731
      * Séparez l'espace de noms du nom de classe.
732 732
      *
@@ -747,7 +747,7 @@  discard block
 block discarded – undo
747 747
     }
748 748
 }
749 749
 
750
-if (! function_exists('view_exist')) {
750
+if (!function_exists('view_exist')) {
751 751
     /**
752 752
      * Verifie si un fichier de vue existe. Utile pour limiter les failles include
753 753
      */
@@ -761,7 +761,7 @@  discard block
 block discarded – undo
761 761
     }
762 762
 }
763 763
 
764
-if (! function_exists('view')) {
764
+if (!function_exists('view')) {
765 765
     /**
766 766
      * Charge une vue
767 767
      *
@@ -777,7 +777,7 @@  discard block
 block discarded – undo
777 777
     }
778 778
 }
779 779
 
780
-if (! function_exists('flash')) {
780
+if (!function_exists('flash')) {
781 781
     /**
782 782
      * Fournisseur d'acces rapide a la classe PHP Flash
783 783
      *
@@ -809,7 +809,7 @@  discard block
 block discarded – undo
809 809
     }*/
810 810
 }
811 811
 
812
-if (! function_exists('geo_ip')) {
812
+if (!function_exists('geo_ip')) {
813 813
     /**
814 814
      * Recuperation des coordonnees (pays, ville, etc) d'un utilisateur en fonction de son ip
815 815
      */
@@ -819,7 +819,7 @@  discard block
 block discarded – undo
819 819
     }
820 820
 }
821 821
 
822
-if (! function_exists('to_stream')) {
822
+if (!function_exists('to_stream')) {
823 823
     /**
824 824
      * Créez un nouveau flux basé sur le type d'entrée.
825 825
      *
@@ -842,7 +842,7 @@  discard block
 block discarded – undo
842 842
     }
843 843
 }
844 844
 
845
-if (! function_exists('value')) {
845
+if (!function_exists('value')) {
846 846
     /**
847 847
      * Renvoie la valeur par défaut de la valeur donnée.
848 848
      *
@@ -856,7 +856,7 @@  discard block
 block discarded – undo
856 856
     }
857 857
 }
858 858
 
859
-if (! function_exists('with')) {
859
+if (!function_exists('with')) {
860 860
     /**
861 861
      * Renvoie la valeur donnée, éventuellement transmise via le rappel donné.
862 862
      *
Please login to merge, or discard this patch.
src/Utilities/Helpers.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
     {
26 26
         static $_is_php;
27 27
 
28
-        if (! isset($_is_php[$version])) {
28
+        if (!isset($_is_php[$version])) {
29 29
             $_is_php[$version] = version_compare(PHP_VERSION, $version, '>=');
30 30
         }
31 31
 
@@ -40,13 +40,13 @@  discard block
 block discarded – undo
40 40
         $host = explode(':', $_SERVER['HTTP_HOST'] ?? '')[0];
41 41
 
42 42
         return
43
-            ! empty($host) // Si c'est vide, ca veut certainement dire qu'on est en CLI, or le CLI << n'est pas >> utilisé en ligne
44
-            && ! in_array($host, ['localhost', '127.0.0.1'], true)
45
-            && ! preg_match('#\.dev$#', $host)
46
-            && ! preg_match('#\.test$#', $host)
47
-            && ! preg_match('#\.lab$#', $host)
48
-            && ! preg_match('#\.loc(al)?$#', $host)
49
-            && ! preg_match('#^192\.168#', $host);
43
+            !empty($host) // Si c'est vide, ca veut certainement dire qu'on est en CLI, or le CLI << n'est pas >> utilisé en ligne
44
+            && !in_array($host, ['localhost', '127.0.0.1'], true)
45
+            && !preg_match('#\.dev$#', $host)
46
+            && !preg_match('#\.test$#', $host)
47
+            && !preg_match('#\.lab$#', $host)
48
+            && !preg_match('#\.loc(al)?$#', $host)
49
+            && !preg_match('#^192\.168#', $host);
50 50
     }
51 51
 
52 52
     /**
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
     public static function isReallyWritable(string $file): bool
66 66
     {
67 67
         // If we're on a Unix server with safe_mode off we call is_writable
68
-        if (DIRECTORY_SEPARATOR === '/' || ! ini_get('safe_mode')) {
68
+        if (DIRECTORY_SEPARATOR === '/' || !ini_get('safe_mode')) {
69 69
             return is_writable($file);
70 70
         }
71 71
 
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 
85 85
             return true;
86 86
         }
87
-        if (! is_file($file) || ($fp = @fopen($file, 'ab')) === false) {
87
+        if (!is_file($file) || ($fp = @fopen($file, 'ab')) === false) {
88 88
             return false;
89 89
         }
90 90
 
@@ -98,23 +98,23 @@  discard block
 block discarded – undo
98 98
         $path  = parse_url($url);
99 99
         $query = '';
100 100
 
101
-        if (! empty($path['host'])) {
101
+        if (!empty($path['host'])) {
102 102
             $r = $path['scheme'] . '://';
103
-            if (! empty($path['user'])) {
103
+            if (!empty($path['user'])) {
104 104
                 $r .= $path['user'];
105
-                if (! empty($path['pass'])) {
105
+                if (!empty($path['pass'])) {
106 106
                     $r .= ':' . $path['pass'] . '@';
107 107
                 }
108 108
                 $r .= '@';
109 109
             }
110
-            if (! empty($path['host'])) {
110
+            if (!empty($path['host'])) {
111 111
                 $r .= $path['host'];
112 112
             }
113
-            if (! empty($path['port'])) {
113
+            if (!empty($path['port'])) {
114 114
                 $r .= ':' . $path['port'];
115 115
             }
116 116
             $url = $r . $path['path'];
117
-            if (! empty($path['query'])) {
117
+            if (!empty($path['query'])) {
118 118
                 $query = '?' . $path['query'];
119 119
             }
120 120
         }
@@ -138,12 +138,12 @@  discard block
 block discarded – undo
138 138
         $non_displayables = [];
139 139
 
140 140
         if ($url_encoded) {
141
-            $non_displayables[] = '/%0[0-8bcef]/i';	// url encoded 00-08, 11, 12, 14, 15
142
-            $non_displayables[] = '/%1[0-9a-f]/i';	// url encoded 16-31
143
-            $non_displayables[] = '/%7f/i';	// url encoded 127
141
+            $non_displayables[] = '/%0[0-8bcef]/i'; // url encoded 00-08, 11, 12, 14, 15
142
+            $non_displayables[] = '/%1[0-9a-f]/i'; // url encoded 16-31
143
+            $non_displayables[] = '/%7f/i'; // url encoded 127
144 144
         }
145 145
 
146
-        $non_displayables[] = '/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]+/S';	// 00-08, 11, 12, 14-31, 127
146
+        $non_displayables[] = '/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]+/S'; // 00-08, 11, 12, 14-31, 127
147 147
 
148 148
         do {
149 149
             $str = preg_replace($non_displayables, '', $str, -1, $count);
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
                 return $data;
187 187
             }
188 188
 
189
-            if (! in_array($context, ['html', 'js', 'css', 'url', 'attr'], true)) {
189
+            if (!in_array($context, ['html', 'js', 'css', 'url', 'attr'], true)) {
190 190
                 throw new InvalidArgumentException('Invalid escape context provided.');
191 191
             }
192 192
 
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
             }
198 198
 
199 199
             static $escaper;
200
-            if (! $escaper) {
200
+            if (!$escaper) {
201 201
                 $escaper = new \Laminas\Escaper\Escaper($encoding);
202 202
             }
203 203
 
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
             $double  = true;
264 264
         }
265 265
 
266
-        return htmlspecialchars($text, ENT_QUOTES | ENT_SUBSTITUTE, $charset ?: $defaultCharset, $double);
266
+        return htmlspecialchars($text, ENT_QUOTES|ENT_SUBSTITUTE, $charset ?: $defaultCharset, $double);
267 267
     }
268 268
 
269 269
     /**
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
     {
373 373
         if ($key === 'HTTPS') {
374 374
             if (isset($_SERVER['HTTPS'])) {
375
-                return ! empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off';
375
+                return !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off';
376 376
             }
377 377
 
378 378
             return strpos((string) self::env('SCRIPT_URI'), 'https://') === 0;
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
                 $name     = (string) self::env('SCRIPT_NAME');
404 404
                 $filename = (string) self::env('SCRIPT_FILENAME');
405 405
                 $offset   = 0;
406
-                if (! strpos($name, '.php')) {
406
+                if (!strpos($name, '.php')) {
407 407
                     $offset = 4;
408 408
                 }
409 409
 
@@ -428,13 +428,13 @@  discard block
 block discarded – undo
428 428
             $server_addr = $_SERVER['HTTP_HOST'] ?? ((strpos($_SERVER['SERVER_ADDR'], ':') !== false) ? '[' . $_SERVER['SERVER_ADDR'] . ']' : $_SERVER['SERVER_ADDR']);
429 429
 
430 430
             if (isset($_SERVER['SERVER_PORT'])) {
431
-                $server_addr .= ':' . ((! preg_match('#:' . $_SERVER['SERVER_PORT'] . '$#', $server_addr)) ? $_SERVER['SERVER_PORT'] : '80');
431
+                $server_addr .= ':' . ((!preg_match('#:' . $_SERVER['SERVER_PORT'] . '$#', $server_addr)) ? $_SERVER['SERVER_PORT'] : '80');
432 432
             }
433 433
 
434 434
             if (
435
-                (! empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off')
435
+                (!empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off')
436 436
                 || (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && strtolower($_SERVER['HTTP_X_FORWARDED_PROTO']) === 'https')
437
-                || (! empty($_SERVER['HTTP_FRONT_END_HTTPS']) && strtolower($_SERVER['HTTP_FRONT_END_HTTPS']) !== 'off')
437
+                || (!empty($_SERVER['HTTP_FRONT_END_HTTPS']) && strtolower($_SERVER['HTTP_FRONT_END_HTTPS']) !== 'off')
438 438
             ) {
439 439
                 $base_url = 'https';
440 440
             } else {
@@ -482,7 +482,7 @@  discard block
 block discarded – undo
482 482
      */
483 483
     public static function deprecationWarning(string $message, int $stackFrame = 1)
484 484
     {
485
-        if (! (error_reporting() & E_USER_DEPRECATED)) {
485
+        if (!(error_reporting() & E_USER_DEPRECATED)) {
486 486
             return;
487 487
         }
488 488
 
Please login to merge, or discard this patch.
src/Cli/Console/Console.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
             foreach (Filesystem::allFiles($path) as $file) {
140 140
                 $name = str_replace([$path, '.' . $file->getExtension(), DS], ['', '', '\\'], $file->getPathname());
141 141
 
142
-                if (! Str::contains($name, 'Generators' . DS . 'Views')) {
142
+                if (!Str::contains($name, 'Generators' . DS . 'Views')) {
143 143
                     $this->addCommand('\BlitzPHP\Cli\Commands\\' . $name);
144 144
                 }
145 145
             }
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
      */
163 163
     private function addCommand(string $commandName)
164 164
     {
165
-        if (! class_exists($commandName)) {
165
+        if (!class_exists($commandName)) {
166 166
             throw new CLIException("La classe `{$commandName}` n'existe pas");
167 167
         }
168 168
 
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
          */
172 172
         $instance = new $commandName($this, Services::logger());
173 173
 
174
-        if (! ($instance instanceof Command)) {
174
+        if (!($instance instanceof Command)) {
175 175
             throw CLIException::invalidCommand($commandName);
176 176
         }
177 177
 
@@ -193,13 +193,13 @@  discard block
 block discarded – undo
193 193
             $value = (array) $value;
194 194
 
195 195
             $description = $value[0];
196
-            if (! is_string($description)) {
196
+            if (!is_string($description)) {
197 197
                 continue;
198 198
             }
199 199
 
200 200
             $default = $value[1] ?? null;
201 201
             $filter  = $value[2] ?? null;
202
-            if ($filter !== null && ! is_callable($filter)) {
202
+            if ($filter !== null && !is_callable($filter)) {
203 203
                 $filter = null;
204 204
             }
205 205
 
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
             $value = (array) $value;
212 212
 
213 213
             $description = $value[0];
214
-            if (! is_string($description)) {
214
+            if (!is_string($description)) {
215 215
                 continue;
216 216
             }
217 217
 
@@ -222,14 +222,14 @@  discard block
 block discarded – undo
222 222
 
223 223
         $console = $this;
224 224
 
225
-        $command->action(static function () use ($instance, $command, $console) {
226
-            if (! $console->suppress) {
225
+        $command->action(static function() use ($instance, $command, $console) {
226
+            if (!$console->suppress) {
227 227
                 $console->start($instance->service);
228 228
             }
229 229
 
230 230
             $result = $instance->execute($command->values(false));
231 231
 
232
-            if (! $console->suppress) {
232
+            if (!$console->suppress) {
233 233
                 $console->end();
234 234
             }
235 235
 
Please login to merge, or discard this patch.