Passed
Push — main ( ebfbeb...970435 )
by Dimitri
04:29
created
src/Helpers/filesystem.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 
12 12
 use BlitzPHP\Loader\Filesystem;
13 13
 
14
-if (! function_exists('directory_map')) {
14
+if (!function_exists('directory_map')) {
15 15
     /**
16 16
      * Créer une carte de répertoire
17 17
      *
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
     }
30 30
 }
31 31
 
32
-if (! function_exists('directory_mirror')) {
32
+if (!function_exists('directory_mirror')) {
33 33
     /**
34 34
      * Copie récursivement les fichiers et répertoires du répertoire d'origine
35 35
      * dans le répertoire cible, c'est-à-dire "miroir" son contenu.
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
     }
43 43
 }
44 44
 
45
-if (! function_exists('write_file')) {
45
+if (!function_exists('write_file')) {
46 46
     /**
47 47
      * Write File
48 48
      *
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
     }
77 77
 }
78 78
 
79
-if (! function_exists('delete_files')) {
79
+if (!function_exists('delete_files')) {
80 80
     /**
81 81
      * Delete Files
82 82
      *
@@ -101,18 +101,18 @@  discard block
 block discarded – undo
101 101
                 RecursiveIteratorIterator::CHILD_FIRST
102 102
             ) as $object) {
103 103
                 $filename = $object->getFilename();
104
-                if (! $hidden && $filename[0] === '.') {
104
+                if (!$hidden && $filename[0] === '.') {
105 105
                     continue;
106 106
                 }
107 107
 
108
-                if (! $htdocs || ! preg_match('/^(\.htaccess|index\.(html|htm|php)|web\.config)$/i', $filename)) {
108
+                if (!$htdocs || !preg_match('/^(\.htaccess|index\.(html|htm|php)|web\.config)$/i', $filename)) {
109 109
                     $isDir = $object->isDir();
110 110
                     if ($isDir && $delDir) {
111 111
                         rmdir($object->getPathname());
112 112
 
113 113
                         continue;
114 114
                     }
115
-                    if (! $isDir) {
115
+                    if (!$isDir) {
116 116
                         unlink($object->getPathname());
117 117
                     }
118 118
                 }
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
     }
126 126
 }
127 127
 
128
-if (! function_exists('get_filenames')) {
128
+if (!function_exists('get_filenames')) {
129 129
     /**
130 130
      * Get Filenames
131 131
      *
@@ -154,11 +154,11 @@  discard block
 block discarded – undo
154 154
                 RecursiveIteratorIterator::SELF_FIRST
155 155
             ) as $name => $object) {
156 156
                 $basename = pathinfo($name, PATHINFO_BASENAME);
157
-                if (! $hidden && $basename[0] === '.') {
157
+                if (!$hidden && $basename[0] === '.') {
158 158
                     continue;
159 159
                 }
160 160
 
161
-                if ($includeDir || ! $object->isDir()) {
161
+                if ($includeDir || !$object->isDir()) {
162 162
                     if ($includePath === false) {
163 163
                         $files[] = $basename;
164 164
                     } elseif ($includePath === null) {
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
     }
179 179
 }
180 180
 
181
-if (! function_exists('get_dir_file_info')) {
181
+if (!function_exists('get_dir_file_info')) {
182 182
     /**
183 183
      * Get Directory File Information
184 184
      *
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
     }
225 225
 }
226 226
 
227
-if (! function_exists('get_file_info')) {
227
+if (!function_exists('get_file_info')) {
228 228
     /**
229 229
      * Get File Info
230 230
      *
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
      */
241 241
     function get_file_info(string $file, $returnedValues = ['name', 'server_path', 'size', 'date'])
242 242
     {
243
-        if (! is_file($file)) {
243
+        if (!is_file($file)) {
244 244
             return null;
245 245
         }
246 246
 
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
     }
291 291
 }
292 292
 
293
-if (! function_exists('symbolic_permissions')) {
293
+if (!function_exists('symbolic_permissions')) {
294 294
     /**
295 295
      * Symbolic Permissions
296 296
      *
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
     }
339 339
 }
340 340
 
341
-if (! function_exists('octal_permissions')) {
341
+if (!function_exists('octal_permissions')) {
342 342
     /**
343 343
      * Octal Permissions
344 344
      *
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
     }
354 354
 }
355 355
 
356
-if (! function_exists('same_file')) {
356
+if (!function_exists('same_file')) {
357 357
     /**
358 358
      * Checks if two files both exist and have identical hashes
359 359
      *
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
     }
366 366
 }
367 367
 
368
-if (! function_exists('set_realpath')) {
368
+if (!function_exists('set_realpath')) {
369 369
     /**
370 370
      * Set Realpath
371 371
      *
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
         // Resolve the path
382 382
         if (realpath($path) !== false) {
383 383
             $path = realpath($path);
384
-        } elseif ($checkExistence && ! is_dir($path) && ! is_file($path)) {
384
+        } elseif ($checkExistence && !is_dir($path) && !is_file($path)) {
385 385
             throw new InvalidArgumentException('Not a valid path: ' . $path);
386 386
         }
387 387
 
Please login to merge, or discard this patch.
src/View/Parser.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 
97 97
         $file = $this->viewPath . $view;
98 98
 
99
-        if (! is_file($file)) {
99
+        if (!is_file($file)) {
100 100
             $fileOrig = $file;
101 101
             $file     = $this->loader->locateFile($view, 'Views');
102 102
 
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
      */
172 172
     public function setData(array $data = [], ?string $context = null): self
173 173
     {
174
-        if (! empty($context)) {
174
+        if (!empty($context)) {
175 175
             foreach ($data as $key => &$value) {
176 176
                 if (is_array($value)) {
177 177
                     foreach ($value as &$obj) {
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
         foreach ($matches as $match) {
280 280
             // Loop over each piece of $data, replacing
281 281
             // its contents so that we know what to replace in parse()
282
-            $str = '';  // holds the new contents for this tag pair.
282
+            $str = ''; // holds the new contents for this tag pair.
283 283
 
284 284
             foreach ($data as $row) {
285 285
                 // Objects that have a `toArray()` method should be
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
                     if (is_array($val)) {
302 302
                         $pair = $this->parsePair($key, $val, $match[1]);
303 303
 
304
-                        if (! empty($pair)) {
304
+                        if (!empty($pair)) {
305 305
                             $pairs[array_keys($pair)[0]] = true;
306 306
 
307 307
                             $temp = array_merge($temp, $pair);
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
 
322 322
                 // Now replace our placeholders with the new content.
323 323
                 foreach ($temp as $pattern => $content) {
324
-                    $out = $this->replaceSingle($pattern, $content, $out, ! isset($pairs[$pattern]));
324
+                    $out = $this->replaceSingle($pattern, $content, $out, !isset($pairs[$pattern]));
325 325
                 }
326 326
 
327 327
                 $str .= $out;
@@ -491,7 +491,7 @@  discard block
 block discarded – undo
491 491
         $content = (string) $content;
492 492
 
493 493
         // Replace the content in the template
494
-        return preg_replace_callback($pattern, function ($matches) use ($content, $escape) {
494
+        return preg_replace_callback($pattern, function($matches) use ($content, $escape) {
495 495
             // Check for {! !} syntax to not escape this one.
496 496
             if (strpos($matches[0], '{!') === 0 && substr($matches[0], -2) === '!}') {
497 497
                 $escape = false;
@@ -510,7 +510,7 @@  discard block
 block discarded – undo
510 510
 
511 511
         // Our regex earlier will leave all chained values on a single line
512 512
         // so we need to break them apart so we can apply them all.
513
-        $filters = ! empty($matches[1]) ? explode('|', $matches[1]) : [];
513
+        $filters = !empty($matches[1]) ? explode('|', $matches[1]) : [];
514 514
 
515 515
         if ($escape && empty($filters) && ($context = $this->shouldAddEscaping($orig))) {
516 516
             $filters[] = "esc({$context})";
@@ -546,7 +546,7 @@  discard block
 block discarded – undo
546 546
             $escape = false;
547 547
         }
548 548
         // If no `esc` filter is found, then we'll need to add one.
549
-        elseif (! preg_match('/\s+esc/', $key)) {
549
+        elseif (!preg_match('/\s+esc/', $key)) {
550 550
             $escape = 'html';
551 551
         }
552 552
 
@@ -565,10 +565,10 @@  discard block
 block discarded – undo
565 565
             preg_match('/\([\w<>=\/\\\,:.\-\s\+]+\)/', $filter, $param);
566 566
 
567 567
             // Remove the () and spaces to we have just the parameter left
568
-            $param = ! empty($param) ? trim($param[0], '() ') : null;
568
+            $param = !empty($param) ? trim($param[0], '() ') : null;
569 569
 
570 570
             // Params can be separated by commas to allow multiple parameters for the filter
571
-            if (! empty($param)) {
571
+            if (!empty($param)) {
572 572
                 $param = explode(',', $param);
573 573
 
574 574
                 // Clean it up
@@ -580,10 +580,10 @@  discard block
 block discarded – undo
580 580
             }
581 581
 
582 582
             // Get our filter name
583
-            $filter = ! empty($param) ? trim(strtolower(substr($filter, 0, strpos($filter, '(')))) : trim($filter);
583
+            $filter = !empty($param) ? trim(strtolower(substr($filter, 0, strpos($filter, '(')))) : trim($filter);
584 584
 
585 585
             $this->config['filters'] ??= [];
586
-            if (! array_key_exists($filter, $this->config['filters'])) {
586
+            if (!array_key_exists($filter, $this->config['filters'])) {
587 587
                 continue;
588 588
             }
589 589
 
@@ -622,7 +622,7 @@  discard block
 block discarded – undo
622 622
              *   $matches[1] = all parameters string in opening tag
623 623
              *   $matches[2] = content between the tags to send to the plugin.
624 624
              */
625
-            if (! preg_match_all($pattern, $template, $matches, PREG_SET_ORDER)) {
625
+            if (!preg_match_all($pattern, $template, $matches, PREG_SET_ORDER)) {
626 626
                 continue;
627 627
             }
628 628
 
Please login to merge, or discard this patch.
src/Cli/Commands/Generators/Command.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -84,14 +84,14 @@
 block discarded – undo
84 84
         $command = is_string($command) ? $command : 'command:name';
85 85
         $type    = is_string($type) ? $type : 'basic';
86 86
 
87
-        if (! in_array($type, ['basic', 'generator'], true)) {
87
+        if (!in_array($type, ['basic', 'generator'], true)) {
88 88
             // @codeCoverageIgnoreStart
89 89
             $type = $this->choice(lang('CLI.generator.commandType'), ['basic', 'generator'], 'basic');
90 90
             $this->eol();
91 91
             // @codeCoverageIgnoreEnd
92 92
         }
93 93
 
94
-        if (! is_string($group)) {
94
+        if (!is_string($group)) {
95 95
             $group = $type === 'generator' ? 'Generators' : 'BlitzPHP';
96 96
         }
97 97
 
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 2 patches
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.
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -82,9 +82,9 @@
 block discarded – undo
82 82
      */
83 83
     public function setMethods(?array $methods): self
84 84
     {
85
-		if (is_array($methods)) {
86
-			$this->methods = $methods;
87
-		}
85
+        if (is_array($methods)) {
86
+            $this->methods = $methods;
87
+        }
88 88
 
89 89
         return $this;
90 90
     }
Please login to merge, or discard this patch.
src/Middlewares/Cors.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
         'AllowMethods'     => ['GET', 'POST', 'PUT', 'PATCH', 'DELETE'],
29 29
         'AllowHeaders'     => true,
30 30
         'ExposeHeaders'    => false,
31
-        'MaxAge'           => 86400,                                       // 1 day
31
+        'MaxAge'           => 86400, // 1 day
32 32
     ];
33 33
 
34 34
     /**
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
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
         $this->config = (object) config('rest');
73 73
 
74 74
         $locale       = $this->config->language ?? null;
75
-        $this->locale = ! empty($locale) ? $locale : $this->request->getLocale();
75
+        $this->locale = !empty($locale) ? $locale : $this->request->getLocale();
76 76
     }
77 77
 
78 78
     public function _remap(string $method, array $params = [])
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
         $class = static::class;
81 81
 
82 82
         // Bien sûr qu'il existe, mais peuvent-ils en faire quelque chose ?
83
-        if (! method_exists($class, $method)) {
83
+        if (!method_exists($class, $method)) {
84 84
             return $this->respondNotImplemented($this->_translate('notImplemented', [$class, $method]));
85 85
         }
86 86
 
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 
108 108
             return $this->respondOk($response);
109 109
         } catch (Throwable $ex) {
110
-            if (! on_dev()) {
110
+            if (!on_dev()) {
111 111
                 $url = explode('?', $this->request->getRequestTarget())[0];
112 112
 
113 113
                 return $this->respondBadRequest($this->_translate('badUsed', [$url]));
@@ -156,18 +156,18 @@  discard block
 block discarded – undo
156 156
     final protected function respondFail(?string $message = "Une erreur s'est produite", ?int $status = StatusCode::INTERNAL_ERROR, int|string|null $code = null, array $errors = [])
157 157
     {
158 158
         $message = $message ?: "Une erreur s'est produite";
159
-        $code    = ! empty($code) ? $code : $status;
159
+        $code    = !empty($code) ? $code : $status;
160 160
 
161 161
         $response = [
162 162
             $this->config->field['message'] ?? 'message' => $message,
163 163
         ];
164
-        if (! empty($this->config->field['status'])) {
164
+        if (!empty($this->config->field['status'])) {
165 165
             $response[$this->config->field['status']] = false;
166 166
         }
167
-        if (! empty($this->config->field['code'])) {
167
+        if (!empty($this->config->field['code'])) {
168 168
             $response[$this->config->field['code']] = $code;
169 169
         }
170
-        if (! empty($errors)) {
170
+        if (!empty($errors)) {
171 171
             $response[$this->config->field['errors'] ?? 'errors'] = $errors;
172 172
         }
173 173
 
@@ -188,12 +188,12 @@  discard block
 block discarded – undo
188 188
     final protected function respondSuccess(?string $message = 'Resultat', $result = null, ?int $status = StatusCode::OK)
189 189
     {
190 190
         $message = $message ?: 'Resultat';
191
-        $status  = ! empty($status) ? $status : StatusCode::OK;
191
+        $status  = !empty($status) ? $status : StatusCode::OK;
192 192
 
193 193
         $response = [
194 194
             $this->config->field['message'] ?? 'message' => $message,
195 195
         ];
196
-        if (! empty($this->config->field['status'])) {
196
+        if (!empty($this->config->field['status'])) {
197 197
             $response[$this->config->field['status']] = true;
198 198
         }
199 199
         if (is_array($result)) {
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
      */
306 306
     final protected function allowedMethods(string ...$methods): self
307 307
     {
308
-        if (! empty($methods)) {
308
+        if (!empty($methods)) {
309 309
             $this->config->allowed_methods = array_map(static fn ($str) => strtoupper($str), $methods);
310 310
         }
311 311
 
@@ -403,13 +403,13 @@  discard block
 block discarded – undo
403 403
         }
404 404
 
405 405
         // Si la méthode de format existe, appelle et renvoie la sortie dans ce format
406
-        if (! empty($mime)) {
406
+        if (!empty($mime)) {
407 407
             $output = Formatter::type($mime)->format($data);
408 408
 
409 409
             // Définit l'en-tête du format
410 410
             // Ensuite, vérifiez si le client a demandé un rappel, et si la sortie contient ce rappel :
411 411
             $callback = $this->request->getQuery('callback');
412
-            if (! empty($callback) && $mime === $this->mimes['json'] && preg_match('/^' . $callback . '/', $output)) {
412
+            if (!empty($callback) && $mime === $this->mimes['json'] && preg_match('/^' . $callback . '/', $output)) {
413 413
                 $this->response = $this->response->withType($this->mimes['jsonp']);
414 414
             } else {
415 415
                 $this->response = $this->response->withType($mime === $this->mimes['array'] ? $this->mimes['json'] : $mime);
@@ -465,22 +465,22 @@  discard block
 block discarded – undo
465 465
     private function checkProcess(): bool|ResponseInterface
466 466
     {
467 467
         // Verifie si la requete est en ajax
468
-        if (! $this->request->is('ajax') && $this->config->ajax_only) {
468
+        if (!$this->request->is('ajax') && $this->config->ajax_only) {
469 469
             return $this->respondNotAcceptable($this->_translate('ajaxOnly'));
470 470
         }
471 471
 
472 472
         // Verifie si la requete est en https
473
-        if (! $this->request->is('https') && $this->config->force_https) {
473
+        if (!$this->request->is('https') && $this->config->force_https) {
474 474
             return $this->respondForbidden($this->_translate('unsupported'));
475 475
         }
476 476
 
477 477
         // Verifie si la methode utilisee pour la requete est autorisee
478
-        if (! in_array(strtoupper($this->request->getMethod()), $this->config->allowed_methods, true)) {
478
+        if (!in_array(strtoupper($this->request->getMethod()), $this->config->allowed_methods, true)) {
479 479
             return $this->respondNotAcceptable($this->_translate('unknownMethod'));
480 480
         }
481 481
 
482 482
         // Verifie que l'ip qui emet la requete n'est pas dans la blacklist
483
-        if (! empty($this->config->ip_blacklis)) {
483
+        if (!empty($this->config->ip_blacklis)) {
484 484
             $this->config->ip_blacklist = implode(',', $this->config->ip_blacklist);
485 485
 
486 486
             // Correspond à une adresse IP dans une liste noire, par ex. 127.0.0.0, 0.0.0.0
@@ -493,20 +493,20 @@  discard block
 block discarded – undo
493 493
         }
494 494
 
495 495
         // Verifie que l'ip qui emet la requete est dans la whitelist
496
-        if (! empty($this->config->ip_whitelist)) {
496
+        if (!empty($this->config->ip_whitelist)) {
497 497
             $whitelist = $this->config->ip_whitelist;
498 498
             array_push($whitelist, '127.0.0.1', '0.0.0.0');
499 499
 
500 500
             // coupez les espaces de début et de fin des ip
501 501
             $whitelist = array_map('trim', $whitelist);
502 502
 
503
-            if (! in_array($this->request->clientIp(), $whitelist, true)) {
503
+            if (!in_array($this->request->clientIp(), $whitelist, true)) {
504 504
                 return $this->respondUnauthorized($this->_translate('ipUnauthorized'));
505 505
             }
506 506
         }
507 507
 
508 508
         // Verifie l'authentification du client
509
-        if (false !== $this->config->auth && ! $this->request->is('options')) {
509
+        if (false !== $this->config->auth && !$this->request->is('options')) {
510 510
             if ('bearer' === strtolower($this->config->auth)) {
511 511
                 $token = $this->getBearerToken();
512 512
                 if (empty($token)) {
Please login to merge, or discard this patch.
src/Initializer/kint.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 Kint::$display_called_from = $config->display_called_from;
20 20
 Kint::$expanded            = $config->expanded;
21 21
 
22
-if (! empty($config->plugins)) {
22
+if (!empty($config->plugins)) {
23 23
     Kint::$plugins = $config->plugins;
24 24
 }
25 25
 
@@ -27,10 +27,10 @@  discard block
 block discarded – undo
27 27
 RichRenderer::$folder = $config->rich_folder;
28 28
 RichRenderer::$sort   = $config->rich_sort;
29 29
 
30
-if (! empty($config->rich_value_plugins)) {
30
+if (!empty($config->rich_value_plugins)) {
31 31
     RichRenderer::$value_plugins = $config->rich_value_plugins;
32 32
 }
33
-if (! empty($config->rich_tab_plugins)) {
33
+if (!empty($config->rich_tab_plugins)) {
34 34
     RichRenderer::$tab_plugins = $config->rich_tab_plugins;
35 35
 }
36 36
 
Please login to merge, or discard this patch.
src/Http/ServerRequest.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
         $this->cookies = $config['cookies'];
258 258
 
259 259
         if (isset($config['uri'])) {
260
-            if (! $config['uri'] instanceof UriInterface) {
260
+            if (!$config['uri'] instanceof UriInterface) {
261 261
                 throw new FrameworkException('The `uri` key must be an instance of ' . UriInterface::class);
262 262
             }
263 263
             $uri = $config['uri'];
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
         $ref = $this->getEnv('HTTP_REFERER');
398 398
 
399 399
         $base = /* Configure::read('App.fullBaseUrl') . */ $this->webroot;
400
-        if (! empty($ref) && ! empty($base)) {
400
+        if (!empty($ref) && !empty($base)) {
401 401
             if ($local && strpos($ref, $base) === 0) {
402 402
                 $ref = substr($ref, strlen($base));
403 403
                 if ($ref === '' || strpos($ref, '//') === 0) {
@@ -409,7 +409,7 @@  discard block
 block discarded – undo
409 409
 
410 410
                 return $ref;
411 411
             }
412
-            if (! $local) {
412
+            if (!$local) {
413 413
                 return $ref;
414 414
             }
415 415
         }
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
         }
462 462
 
463 463
         $type = strtolower($type);
464
-        if (! isset(static::$_detectors[$type])) {
464
+        if (!isset(static::$_detectors[$type])) {
465 465
             return false;
466 466
         }
467 467
         if ($args) {
@@ -540,7 +540,7 @@  discard block
 block discarded – undo
540 540
         foreach ($detect['header'] as $header => $value) {
541 541
             $header = $this->getEnv('http_' . $header);
542 542
             if ($header !== null) {
543
-                if (! is_string($value) && ! is_bool($value) && is_callable($value)) {
543
+                if (!is_string($value) && !is_bool($value) && is_callable($value)) {
544 544
                     return $value($header);
545 545
                 }
546 546
 
@@ -613,7 +613,7 @@  discard block
 block discarded – undo
613 613
     public function isAll(array $types): bool
614 614
     {
615 615
         foreach ($types as $type) {
616
-            if (! $this->is($type)) {
616
+            if (!$this->is($type)) {
617 617
                 return false;
618 618
             }
619 619
         }
@@ -716,7 +716,7 @@  discard block
 block discarded – undo
716 716
     protected function normalizeHeaderName(string $name): string
717 717
     {
718 718
         $name = str_replace('-', '_', strtoupper($name));
719
-        if (! in_array($name, ['CONTENT_LENGTH', 'CONTENT_TYPE'], true)) {
719
+        if (!in_array($name, ['CONTENT_LENGTH', 'CONTENT_TYPE'], true)) {
720 720
             $name = 'HTTP_' . $name;
721 721
         }
722 722
 
@@ -899,8 +899,8 @@  discard block
 block discarded – undo
899 899
         $new = clone $this;
900 900
 
901 901
         if (
902
-            ! is_string($method)
903
-            || ! preg_match('/^[!#$%&\'*+.^_`\|~0-9a-z-]+$/i', $method)
902
+            !is_string($method)
903
+            || !preg_match('/^[!#$%&\'*+.^_`\|~0-9a-z-]+$/i', $method)
904 904
         ) {
905 905
             throw new InvalidArgumentException(sprintf(
906 906
                 'Unsupported HTTP method "%s" provided',
@@ -1144,7 +1144,7 @@  discard block
 block discarded – undo
1144 1144
                 }
1145 1145
             }
1146 1146
 
1147
-            if (! isset($accept[$prefValue])) {
1147
+            if (!isset($accept[$prefValue])) {
1148 1148
                 $accept[$prefValue] = [];
1149 1149
             }
1150 1150
             if ($prefValue) {
@@ -1222,7 +1222,7 @@  discard block
 block discarded – undo
1222 1222
         if ($name === null) {
1223 1223
             return $this->data;
1224 1224
         }
1225
-        if (! is_array($this->data) && $name) {
1225
+        if (!is_array($this->data) && $name) {
1226 1226
             return $default;
1227 1227
         }
1228 1228
 
@@ -1363,7 +1363,7 @@  discard block
 block discarded – undo
1363 1363
      */
1364 1364
     public function withProtocolVersion($version): self
1365 1365
     {
1366
-        if (! preg_match('/^(1\.[01]|2(\.[0])?)$/', $version)) {
1366
+        if (!preg_match('/^(1\.[01]|2(\.[0])?)$/', $version)) {
1367 1367
             throw new InvalidArgumentException("Unsupported protocol version '{$version}' provided");
1368 1368
         }
1369 1369
         $new           = clone $this;
@@ -1385,7 +1385,7 @@  discard block
 block discarded – undo
1385 1385
     public function getEnv(string $key, ?string $default = null): ?string
1386 1386
     {
1387 1387
         $key = strtoupper($key);
1388
-        if (! array_key_exists($key, $this->_environment)) {
1388
+        if (!array_key_exists($key, $this->_environment)) {
1389 1389
             $this->_environment[$key] = env($key);
1390 1390
         }
1391 1391
 
@@ -1597,7 +1597,7 @@  discard block
 block discarded – undo
1597 1597
         $file = Arr::get($this->uploadedFiles, $path);
1598 1598
         if (is_array($file)) {
1599 1599
             foreach ($file as $f) {
1600
-                if (! ($f instanceof UploadedFile)) {
1600
+                if (!($f instanceof UploadedFile)) {
1601 1601
                     return null;
1602 1602
                 }
1603 1603
             }
@@ -1605,7 +1605,7 @@  discard block
 block discarded – undo
1605 1605
             return $file;
1606 1606
         }
1607 1607
 
1608
-        if (! ($file instanceof UploadedFileInterface)) {
1608
+        if (!($file instanceof UploadedFileInterface)) {
1609 1609
             return null;
1610 1610
         }
1611 1611
 
@@ -1653,7 +1653,7 @@  discard block
 block discarded – undo
1653 1653
                 continue;
1654 1654
             }
1655 1655
 
1656
-            if (! $file instanceof UploadedFileInterface) {
1656
+            if (!$file instanceof UploadedFileInterface) {
1657 1657
                 throw new InvalidArgumentException("Invalid file at '{$path}{$key}'");
1658 1658
             }
1659 1659
         }
@@ -1704,7 +1704,7 @@  discard block
 block discarded – undo
1704 1704
         }
1705 1705
 
1706 1706
         $host = $uri->getHost();
1707
-        if (! $host) {
1707
+        if (!$host) {
1708 1708
             return $new;
1709 1709
         }
1710 1710
         $port = $uri->getPort();
@@ -1812,7 +1812,7 @@  discard block
 block discarded – undo
1812 1812
         $validLocales = config('app.supported_locales');
1813 1813
         // S'il ne s'agit pas d'un paramètre régional valide, définissez-le
1814 1814
         // aux paramètres régionaux par défaut du site.
1815
-        if (! in_array($locale, $validLocales, true)) {
1815
+        if (!in_array($locale, $validLocales, true)) {
1816 1816
             $locale = config('app.language');
1817 1817
         }
1818 1818
 
@@ -1912,7 +1912,7 @@  discard block
 block discarded – undo
1912 1912
             $override = true;
1913 1913
         }
1914 1914
 
1915
-        if ($override && ! in_array($this->_environment['REQUEST_METHOD'], ['PUT', 'POST', 'DELETE', 'PATCH'], true)) {
1915
+        if ($override && !in_array($this->_environment['REQUEST_METHOD'], ['PUT', 'POST', 'DELETE', 'PATCH'], true)) {
1916 1916
             $data = [];
1917 1917
         }
1918 1918
 
@@ -1961,7 +1961,7 @@  discard block
 block discarded – undo
1961 1961
      */
1962 1962
     protected function _processFiles(array $post, array $files): array
1963 1963
     {
1964
-        if (! is_array($files)) {
1964
+        if (!is_array($files)) {
1965 1965
             return $post;
1966 1966
         }
1967 1967
 
Please login to merge, or discard this patch.