Passed
Push — main ( c0f50c...cd5116 )
by Dimitri
04:24
created
src/Router/Dispatcher.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
             $controller = $routes->getDefaultController();
177 177
         }
178 178
 
179
-        if (! $fullName && is_string($controller)) {
179
+        if (!$fullName && is_string($controller)) {
180 180
             $controller = str_replace($routes->getDefaultNamespace(), '', $controller);
181 181
         }
182 182
 
@@ -302,14 +302,14 @@  discard block
 block discarded – undo
302 302
             return;
303 303
         }
304 304
 
305
-        if (is_cli() && ! on_test()) {
305
+        if (is_cli() && !on_test()) {
306 306
             // @codeCoverageIgnoreStart
307 307
             // $this->request = Services::clirequest($this->config);
308 308
             // @codeCoverageIgnoreEnd
309 309
         }
310 310
 
311 311
         $version = $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.1';
312
-        if (! is_numeric($version)) {
312
+        if (!is_numeric($version)) {
313 313
             $version = substr($version, strpos($version, '/') + 1);
314 314
         }
315 315
 
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
         // Supposons le succès jusqu'à preuve du contraire.
329 329
         $this->response = Services::response()->withStatus(200);
330 330
 
331
-        if (! is_cli() || on_test()) {
331
+        if (!is_cli() || on_test()) {
332 332
         }
333 333
 
334 334
         $this->response = $this->response->withProtocolVersion($this->request->getProtocolVersion());
@@ -425,7 +425,7 @@  discard block
 block discarded – undo
425 425
         }
426 426
 
427 427
         // Essayez de charger automatiquement la classe
428
-        if (! class_exists($this->controller, true) || ($this->method[0] === '_' && $this->method !== '__invoke')) {
428
+        if (!class_exists($this->controller, true) || ($this->method[0] === '_' && $this->method !== '__invoke')) {
429 429
             throw PageNotFoundException::controllerNotFound($this->controller, $this->method);
430 430
         }
431 431
 
@@ -514,7 +514,7 @@  discard block
 block discarded – undo
514 514
 
515 515
         $this->outputBufferingEnd();
516 516
 
517
-        throw PageNotFoundException::pageNotFound(! on_prod() || is_cli() ? $e->getMessage() : '');
517
+        throw PageNotFoundException::pageNotFound(!on_prod() || is_cli() ? $e->getMessage() : '');
518 518
     }
519 519
 
520 520
     /**
@@ -556,7 +556,7 @@  discard block
 block discarded – undo
556 556
     public function storePreviousURL($uri)
557 557
     {
558 558
         // Ignorer les requêtes CLI
559
-        if (is_cli() && ! on_test()) {
559
+        if (is_cli() && !on_test()) {
560 560
             return; // @codeCoverageIgnore
561 561
         }
562 562
 
@@ -566,7 +566,7 @@  discard block
 block discarded – undo
566 566
         }
567 567
 
568 568
         // Ignorer les reponses non-HTML
569
-        if (! str_contains($this->response->getHeaderLine('Content-Type'), 'text/html')) {
569
+        if (!str_contains($this->response->getHeaderLine('Content-Type'), 'text/html')) {
570 570
             return;
571 571
         }
572 572
 
@@ -590,7 +590,7 @@  discard block
 block discarded – undo
590 590
      */
591 591
     protected function sendResponse()
592 592
     {
593
-        if (! ($this->request->expectsJson() || $this->request->isJson())) {
593
+        if (!($this->request->expectsJson() || $this->request->isJson())) {
594 594
             $this->response = Services::toolbar()->prepare(
595 595
                 $this->getPerformanceStats(),
596 596
                 $this->request,
@@ -683,11 +683,11 @@  discard block
 block discarded – undo
683 683
      */
684 684
     private function spoofRequestMethod(): callable
685 685
     {
686
-        return static function (ServerRequestInterface $request, ResponseInterface $response, callable $next) {
686
+        return static function(ServerRequestInterface $request, ResponseInterface $response, callable $next) {
687 687
             $post = $request->getParsedBody();
688 688
 
689 689
             // Ne fonctionne qu'avec les formulaires POST
690
-            if ($request->getMethod() === 'POST' && ! empty($post['_method'])) {
690
+            if ($request->getMethod() === 'POST' && !empty($post['_method'])) {
691 691
                 // Accepte seulement PUT, PATCH, DELETE
692 692
                 if (in_array($post['_method'], ['PUT', 'PATCH', 'DELETE'], true)) {
693 693
                     $request = $request->withMethod($post['_method']);
@@ -700,7 +700,7 @@  discard block
 block discarded – undo
700 700
 
701 701
     private function bootApp(): callable
702 702
     {
703
-        return function (ServerRequestInterface $request, ResponseInterface $response, callable $next): ResponseInterface {
703
+        return function(ServerRequestInterface $request, ResponseInterface $response, callable $next): ResponseInterface {
704 704
             Services::set(Request::class, $request);
705 705
             Services::set(Response::class, $response);
706 706
 
@@ -708,10 +708,10 @@  discard block
 block discarded – undo
708 708
                 $returned = $this->startController();
709 709
 
710 710
                 // Les controleur sous forme de Closure sont executes dans startController().
711
-                if (! is_callable($this->controller)) {
711
+                if (!is_callable($this->controller)) {
712 712
                     $controller = $this->createController($request, $response);
713 713
 
714
-                    if (! method_exists($controller, '_remap') && ! is_callable([$controller, $this->method], false)) {
714
+                    if (!method_exists($controller, '_remap') && !is_callable([$controller, $this->method], false)) {
715 715
                         throw PageNotFoundException::methodNotFound($this->method);
716 716
                     }
717 717
 
Please login to merge, or discard this patch.