Passed
Push — main ( 99c066...305d80 )
by Dimitri
04:43
created
src/Router/Dispatcher.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
             $controller = $routes->getDefaultController();
176 176
         }
177 177
 
178
-        if (! $fullName && is_string($controller)) {
178
+        if (!$fullName && is_string($controller)) {
179 179
             $controller = str_replace($routes->getDefaultNamespace(), '', $controller);
180 180
         }
181 181
 
@@ -301,14 +301,14 @@  discard block
 block discarded – undo
301 301
             return;
302 302
         }
303 303
 
304
-        if (is_cli() && ! on_test()) {
304
+        if (is_cli() && !on_test()) {
305 305
             // @codeCoverageIgnoreStart
306 306
             // $this->request = Services::clirequest($this->config);
307 307
             // @codeCoverageIgnoreEnd
308 308
         }
309 309
 
310 310
         $version = $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.1';
311
-        if (! is_numeric($version)) {
311
+        if (!is_numeric($version)) {
312 312
             $version = substr($version, strpos($version, '/') + 1);
313 313
         }
314 314
 
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
         // Supposons le succès jusqu'à preuve du contraire.
328 328
         $this->response = Services::response()->withStatus(200);
329 329
 
330
-        if (! is_cli() || on_test()) {
330
+        if (!is_cli() || on_test()) {
331 331
         }
332 332
 
333 333
         $this->response = $this->response->withProtocolVersion($this->request->getProtocolVersion());
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
         }
425 425
 
426 426
         // Essayez de charger automatiquement la classe
427
-        if (! class_exists($this->controller, true) || ($this->method[0] === '_' && $this->method !== '__invoke')) {
427
+        if (!class_exists($this->controller, true) || ($this->method[0] === '_' && $this->method !== '__invoke')) {
428 428
             throw PageNotFoundException::controllerNotFound($this->controller, $this->method);
429 429
         }
430 430
 
@@ -513,7 +513,7 @@  discard block
 block discarded – undo
513 513
 
514 514
         $this->outputBufferingEnd();
515 515
 
516
-        throw PageNotFoundException::pageNotFound(! on_prod() || is_cli() ? $e->getMessage() : '');
516
+        throw PageNotFoundException::pageNotFound(!on_prod() || is_cli() ? $e->getMessage() : '');
517 517
     }
518 518
 
519 519
     /**
@@ -555,7 +555,7 @@  discard block
 block discarded – undo
555 555
     public function storePreviousURL($uri)
556 556
     {
557 557
         // Ignorer les requêtes CLI
558
-        if (is_cli() && ! on_test()) {
558
+        if (is_cli() && !on_test()) {
559 559
             return; // @codeCoverageIgnore
560 560
         }
561 561
 
@@ -565,7 +565,7 @@  discard block
 block discarded – undo
565 565
         }
566 566
 
567 567
         // Ignorer les reponses non-HTML
568
-        if (! str_contains($this->response->getHeaderLine('Content-Type'), 'text/html')) {
568
+        if (!str_contains($this->response->getHeaderLine('Content-Type'), 'text/html')) {
569 569
             return;
570 570
         }
571 571
 
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
      */
590 590
     protected function sendResponse()
591 591
     {
592
-        if (! ($this->request->expectsJson() || $this->request->isJson() || Text::contains($this->response->getType(), ['/json', '+json']))) {
592
+        if (!($this->request->expectsJson() || $this->request->isJson() || Text::contains($this->response->getType(), ['/json', '+json']))) {
593 593
             $this->response = Services::toolbar()->prepare(
594 594
                 $this->getPerformanceStats(),
595 595
                 $this->request,
@@ -682,11 +682,11 @@  discard block
 block discarded – undo
682 682
      */
683 683
     private function spoofRequestMethod(): callable
684 684
     {
685
-        return static function (ServerRequestInterface $request, ResponseInterface $response, callable $next) {
685
+        return static function(ServerRequestInterface $request, ResponseInterface $response, callable $next) {
686 686
             $post = $request->getParsedBody();
687 687
 
688 688
             // Ne fonctionne qu'avec les formulaires POST
689
-            if ($request->getMethod() === 'POST' && ! empty($post['_method'])) {
689
+            if ($request->getMethod() === 'POST' && !empty($post['_method'])) {
690 690
                 // Accepte seulement PUT, PATCH, DELETE
691 691
                 if (in_array($post['_method'], ['PUT', 'PATCH', 'DELETE'], true)) {
692 692
                     $request = $request->withMethod($post['_method']);
@@ -699,7 +699,7 @@  discard block
 block discarded – undo
699 699
 
700 700
     private function bootApp(): callable
701 701
     {
702
-        return function (ServerRequestInterface $request, ResponseInterface $response, callable $next): ResponseInterface {
702
+        return function(ServerRequestInterface $request, ResponseInterface $response, callable $next): ResponseInterface {
703 703
             Services::set(Request::class, $request);
704 704
             Services::set(Response::class, $response);
705 705
 
@@ -707,10 +707,10 @@  discard block
 block discarded – undo
707 707
                 $returned = $this->startController();
708 708
 
709 709
                 // Les controleur sous forme de Closure sont executes dans startController().
710
-                if (! is_callable($this->controller)) {
710
+                if (!is_callable($this->controller)) {
711 711
                     $controller = $this->createController($request, $response);
712 712
 
713
-                    if (! method_exists($controller, '_remap') && ! is_callable([$controller, $this->method], false)) {
713
+                    if (!method_exists($controller, '_remap') && !is_callable([$controller, $this->method], false)) {
714 714
                         throw PageNotFoundException::methodNotFound($this->method);
715 715
                     }
716 716
 
Please login to merge, or discard this patch.
src/Http/Response.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
         $this->_streamMode   = $options['streamMode'] ?? $this->_streamMode;
460 460
 
461 461
         if (isset($options['stream'])) {
462
-            if (! $options['stream'] instanceof StreamInterface) {
462
+            if (!$options['stream'] instanceof StreamInterface) {
463 463
                 throw new InvalidArgumentException('Stream option must be an object that implements StreamInterface');
464 464
             }
465 465
             $this->stream = $options['stream'];
@@ -475,7 +475,7 @@  discard block
 block discarded – undo
475 475
             $this->_setStatus($options['status']);
476 476
         }
477 477
 
478
-        if (! isset($options['charset'])) {
478
+        if (!isset($options['charset'])) {
479 479
             $options['charset'] = config('app.charset');
480 480
         }
481 481
         $this->_charset = $options['charset'];
@@ -523,7 +523,7 @@  discard block
 block discarded – undo
523 523
             $charset = true;
524 524
         }
525 525
 
526
-        if ($charset && ! str_contains($type, ';')) {
526
+        if ($charset && !str_contains($type, ';')) {
527 527
             $this->_setHeader('Content-Type', "{$type}; charset={$this->_charset}");
528 528
         } else {
529 529
             $this->_setHeader('Content-Type', $type);
@@ -603,7 +603,7 @@  discard block
 block discarded – undo
603 603
     protected function _clearHeader(string $header): void
604 604
     {
605 605
         $normalized = strtolower($header);
606
-        if (! isset($this->headerNames[$normalized])) {
606
+        if (!isset($this->headerNames[$normalized])) {
607 607
             return;
608 608
         }
609 609
         $original = $this->headerNames[$normalized];
@@ -670,7 +670,7 @@  discard block
 block discarded – undo
670 670
             throw HttpException::invalidStatusCode($code);
671 671
         }
672 672
 
673
-        if (! array_key_exists($code, $this->_statusCodes) && empty($reasonPhrase)) {
673
+        if (!array_key_exists($code, $this->_statusCodes) && empty($reasonPhrase)) {
674 674
             throw HttPException::unkownStatusCode($code);
675 675
         }
676 676
 
@@ -763,7 +763,7 @@  discard block
 block discarded – undo
763 763
         if ($mapped) {
764 764
             return is_array($mapped) ? current($mapped) : $mapped;
765 765
         }
766
-        if (! str_contains($contentType, '/')) {
766
+        if (!str_contains($contentType, '/')) {
767 767
             throw new InvalidArgumentException(sprintf('"%s" is an invalid content type.', $contentType));
768 768
         }
769 769
 
@@ -846,7 +846,7 @@  discard block
 block discarded – undo
846 846
      */
847 847
     public function withCache($since, $time = '+1 day'): static
848 848
     {
849
-        if (! is_int($time)) {
849
+        if (!is_int($time)) {
850 850
             $time = strtotime($time);
851 851
             if ($time === false) {
852 852
                 throw new InvalidArgumentException(
@@ -1314,7 +1314,7 @@  discard block
 block discarded – undo
1314 1314
      */
1315 1315
     public function getCookie(string $name): ?array
1316 1316
     {
1317
-        if (! $this->hasCookie($name)) {
1317
+        if (!$this->hasCookie($name)) {
1318 1318
             return null;
1319 1319
         }
1320 1320
 
@@ -1326,7 +1326,7 @@  discard block
 block discarded – undo
1326 1326
      */
1327 1327
     public function hasCookie(string $name, ?string $value = null): bool
1328 1328
     {
1329
-        if (! $this->_cookies->has($name)) {
1329
+        if (!$this->_cookies->has($name)) {
1330 1330
             return false;
1331 1331
         }
1332 1332
 
@@ -1403,7 +1403,7 @@  discard block
 block discarded – undo
1403 1403
 
1404 1404
         $extension = strtolower($file->getExtension());
1405 1405
         $mapped    = $this->getMimeType($extension);
1406
-        if ((! $extension || ! $mapped) && $options['download'] === null) {
1406
+        if ((!$extension || !$mapped) && $options['download'] === null) {
1407 1407
             $options['download'] = true;
1408 1408
         }
1409 1409
 
@@ -1465,12 +1465,12 @@  discard block
 block discarded – undo
1465 1465
         if (str_contains($path, '../') || str_contains($path, '..\\')) {
1466 1466
             throw new LoadException('The requested file contains `..` and will not be read.');
1467 1467
         }
1468
-        if (! is_file($path)) {
1468
+        if (!is_file($path)) {
1469 1469
             $path = APP_PATH . $path;
1470 1470
         }
1471 1471
 
1472 1472
         $file = new SplFileInfo($path);
1473
-        if (! $file->isFile() || ! $file->isReadable()) {
1473
+        if (!$file->isFile() || !$file->isReadable()) {
1474 1474
             if (on_dev()) {
1475 1475
                 throw new LoadException(sprintf('The requested file %s was not found or not readable', $path));
1476 1476
             }
Please login to merge, or discard this patch.
src/Http/UrlGenerator.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
     {
257 257
         $route = $this->routes->reverseRoute($name, ...$parameters);
258 258
 
259
-        if (! $route) {
259
+        if (!$route) {
260 260
             throw HttpException::invalidRedirectRoute($route);
261 261
         }
262 262
 
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
 
277 277
         $route = $this->routes->reverseRoute($action, ...$parameters);
278 278
 
279
-        if (! $route) {
279
+        if (!$route) {
280 280
             throw RouterException::actionNotDefined($action);
281 281
         }
282 282
 
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
      */
348 348
     public function isValidUrl(string $path): bool
349 349
     {
350
-        if (! preg_match('~^(#|//|https?://|(mailto|tel|sms):)~', $path)) {
350
+        if (!preg_match('~^(#|//|https?://|(mailto|tel|sms):)~', $path)) {
351 351
             return filter_var($path, FILTER_VALIDATE_URL) !== false;
352 352
         }
353 353
 
Please login to merge, or discard this patch.
src/Http/Concerns/ResponseTrait.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
      */
167 167
     public function download(SplFileInfo|string $file, ?string $name = null, array $headers = []): static
168 168
     {
169
-        if (is_string($file) && ! is_file($file)) {
169
+        if (is_string($file) && !is_file($file)) {
170 170
             throw new LoadException('The requested file was not found');
171 171
         }
172 172
 
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
      */
179 179
     public function streamDownload(callable|StreamInterface|string $stream, string $name, array $headers = []): static
180 180
     {
181
-        if (! ($stream instanceof StreamInterface)) {
181
+        if (!($stream instanceof StreamInterface)) {
182 182
             $stream = to_stream($stream);
183 183
         }
184 184
 
Please login to merge, or discard this patch.