Passed
Push — main ( 4ee80d...af755d )
by Dimitri
03:46
created
src/Router/Dispatcher.php 2 patches
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
             $controller = $routes->getDefaultController();
167 167
         }
168 168
 
169
-		if (! $fullName && is_string($controller)) {
169
+        if (! $fullName && is_string($controller)) {
170 170
             $controller = str_replace($routes->getDefaultNamespace(), '', $controller);
171 171
         }
172 172
 
@@ -202,9 +202,9 @@  discard block
 block discarded – undo
202 202
         /**
203 203
          * Init event manager
204 204
          */
205
-		Services::singleton(EventDiscover::class)->discove();
205
+        Services::singleton(EventDiscover::class)->discove();
206 206
 
207
-		$this->event->trigger('pre_system');
207
+        $this->event->trigger('pre_system');
208 208
 
209 209
         // Recherche une page en cache. L'exécution s'arrêtera
210 210
         // si la page a été mise en cache.
@@ -750,13 +750,13 @@  discard block
 block discarded – undo
750 750
             $uri = Services::uri($uri, false);
751 751
         }
752 752
 
753
-		Services::session()->setPreviousUrl(Uri::createURIString(
754
-			$uri->getScheme(),
755
-			$uri->getAuthority(),
756
-			$uri->getPath(),
757
-			$uri->getQuery(),
758
-			$uri->getFragment()
759
-		));
753
+        Services::session()->setPreviousUrl(Uri::createURIString(
754
+            $uri->getScheme(),
755
+            $uri->getAuthority(),
756
+            $uri->getPath(),
757
+            $uri->getQuery(),
758
+            $uri->getFragment()
759
+        ));
760 760
     }
761 761
 
762 762
     /**
@@ -788,9 +788,9 @@  discard block
 block discarded – undo
788 788
             return $returned;
789 789
         }
790 790
 
791
-		if ($returned instanceof Responsable) {
792
-			return $returned->toResponse($this->request);
793
-		}
791
+        if ($returned instanceof Responsable) {
792
+            return $returned->toResponse($this->request);
793
+        }
794 794
 
795 795
         if (is_object($returned)) {
796 796
             if (method_exists($returned, '__toString')) {
@@ -906,7 +906,7 @@  discard block
 block discarded – undo
906 906
 
907 907
 				
908 908
                 if (is_string($this->controller)) {
909
-					if (strtoupper($request->getMethod()) === 'POST') {
909
+                    if (strtoupper($request->getMethod()) === 'POST') {
910 910
                         if (is_subclass_of($this->controller, RestController::class)) {
911 911
                             return $this->formatResponse($response->withStatus($code), [
912 912
                                 'success' => false,
@@ -914,7 +914,7 @@  discard block
 block discarded – undo
914 914
                                 'errors'  => $errors,
915 915
                             ]);
916 916
                         }
917
-						if (is_subclass_of($this->controller, BaseController::class)) {
917
+                        if (is_subclass_of($this->controller, BaseController::class)) {
918 918
                             return Services::redirection()->back()->withInput()->withErrors($errors)->withStatus($code);
919 919
                         }
920 920
                     }
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
             $controller = $routes->getDefaultController();
167 167
         }
168 168
 
169
-		if (! $fullName && is_string($controller)) {
169
+		if (!$fullName && is_string($controller)) {
170 170
             $controller = str_replace($routes->getDefaultNamespace(), '', $controller);
171 171
         }
172 172
 
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
          */
273 273
         $this->gatherOutput($this->middleware->handle($this->request));
274 274
 
275
-        if (! $this->returnResponse) {
275
+        if (!$this->returnResponse) {
276 276
             $this->sendResponse();
277 277
         }
278 278
 
@@ -320,14 +320,14 @@  discard block
 block discarded – undo
320 320
             return;
321 321
         }
322 322
 
323
-        if (is_cli() && ! on_test()) {
323
+        if (is_cli() && !on_test()) {
324 324
             // @codeCoverageIgnoreStart
325 325
             // $this->request = Services::clirequest($this->config);
326 326
             // @codeCoverageIgnoreEnd
327 327
         }
328 328
 
329 329
         $version = $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.1';
330
-        if (! is_numeric($version)) {
330
+        if (!is_numeric($version)) {
331 331
             $version = substr($version, strpos($version, '/') + 1);
332 332
         }
333 333
 
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
         // Supposons le succès jusqu'à preuve du contraire.
347 347
         $this->response = Services::response()->withStatus(200);
348 348
 
349
-        if (! is_cli() || on_test()) {
349
+        if (!is_cli() || on_test()) {
350 350
         }
351 351
 
352 352
         $this->response = $this->response->withProtocolVersion($this->request->getProtocolVersion());
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
     {
383 383
         if ($cachedResponse = Services::cache()->read($this->generateCacheName())) {
384 384
             $cachedResponse = unserialize($cachedResponse);
385
-            if (! is_array($cachedResponse) || ! isset($cachedResponse['output']) || ! isset($cachedResponse['headers'])) {
385
+            if (!is_array($cachedResponse) || !isset($cachedResponse['output']) || !isset($cachedResponse['headers'])) {
386 386
                 throw new FrameworkException('Erreur lors de la désérialisation du cache de page');
387 387
             }
388 388
 
@@ -516,7 +516,7 @@  discard block
 block discarded – undo
516 516
      */
517 517
     protected function determinePath(): string
518 518
     {
519
-        if (! empty($this->path)) {
519
+        if (!empty($this->path)) {
520 520
             return $this->path;
521 521
         }
522 522
 
@@ -570,7 +570,7 @@  discard block
 block discarded – undo
570 570
         }
571 571
 
572 572
         // Essayez de charger automatiquement la classe
573
-        if (! class_exists($this->controller, true) || ($this->method[0] === '_' && $this->method !== '__invoke')) {
573
+        if (!class_exists($this->controller, true) || ($this->method[0] === '_' && $this->method !== '__invoke')) {
574 574
             throw PageNotFoundException::controllerNotFound($this->controller, $this->method);
575 575
         }
576 576
 
@@ -664,7 +664,7 @@  discard block
 block discarded – undo
664 664
         // Affiche l'erreur 404
665 665
         $this->response = $this->response->withStatus($e->getCode());
666 666
 
667
-        if (! on_test()) {
667
+        if (!on_test()) {
668 668
             // @codeCoverageIgnoreStart
669 669
             if (ob_get_level() > 0) {
670 670
                 ob_end_flush();
@@ -676,7 +676,7 @@  discard block
 block discarded – undo
676 676
             ob_end_flush(); // @codeCoverageIgnore
677 677
         }
678 678
 
679
-        throw PageNotFoundException::pageNotFound(! on_prod() || is_cli() ? $e->getMessage() : '');
679
+        throw PageNotFoundException::pageNotFound(!on_prod() || is_cli() ? $e->getMessage() : '');
680 680
     }
681 681
 
682 682
     /**
@@ -731,7 +731,7 @@  discard block
 block discarded – undo
731 731
     public function storePreviousURL($uri)
732 732
     {
733 733
         // Ignorer les requêtes CLI
734
-        if (is_cli() && ! on_test()) {
734
+        if (is_cli() && !on_test()) {
735 735
             return; // @codeCoverageIgnore
736 736
         }
737 737
 
@@ -840,7 +840,7 @@  discard block
 block discarded – undo
840 840
         ]);
841 841
 
842 842
         $middlewaresFile = CONFIG_PATH . 'middlewares.php';
843
-        if (file_exists($middlewaresFile) && ! in_array($middlewaresFile, get_included_files(), true)) {
843
+        if (file_exists($middlewaresFile) && !in_array($middlewaresFile, get_included_files(), true)) {
844 844
             $middleware = require $middlewaresFile;
845 845
             if (is_callable($middleware)) {
846 846
                 $middleware($this->middleware, $this->request);
@@ -856,11 +856,11 @@  discard block
 block discarded – undo
856 856
      */
857 857
     private function spoofRequestMethod(): callable
858 858
     {
859
-        return static function (ServerRequestInterface $request, ResponseInterface $response, callable $next) {
859
+        return static function(ServerRequestInterface $request, ResponseInterface $response, callable $next) {
860 860
             $post = $request->getParsedBody();
861 861
 
862 862
             // Ne fonctionne qu'avec les formulaires POST
863
-            if (strtoupper($request->getMethod()) === 'POST' && ! empty($post['_method'])) {
863
+            if (strtoupper($request->getMethod()) === 'POST' && !empty($post['_method'])) {
864 864
                 // Accepte seulement PUT, PATCH, DELETE
865 865
                 if (in_array(strtoupper($post['_method']), ['PUT', 'PATCH', 'DELETE'], true)) {
866 866
                     $request = $request->withMethod($post['_method']);
@@ -873,15 +873,15 @@  discard block
 block discarded – undo
873 873
 
874 874
     private function bootApp(): callable
875 875
     {
876
-        return function (ServerRequestInterface $request, ResponseInterface $response, callable $next): ResponseInterface {
876
+        return function(ServerRequestInterface $request, ResponseInterface $response, callable $next): ResponseInterface {
877 877
             try {
878 878
                 $returned = $this->startController($request, $response);
879 879
 
880 880
                 // Closure controller has run in startController().
881
-                if (! is_callable($this->controller)) {
881
+                if (!is_callable($this->controller)) {
882 882
                     $controller = $this->createController($request, $response);
883 883
 
884
-                    if (! method_exists($controller, '_remap') && ! is_callable([$controller, $this->method], false)) {
884
+                    if (!method_exists($controller, '_remap') && !is_callable([$controller, $this->method], false)) {
885 885
                         throw PageNotFoundException::methodNotFound($this->method);
886 886
                     }
887 887
 
Please login to merge, or discard this patch.
src/Event/EventDiscover.php 2 patches
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -21,25 +21,25 @@
 block discarded – undo
21 21
  */
22 22
 class EventDiscover
23 23
 {
24
-	protected Locator $locator;
24
+    protected Locator $locator;
25 25
 
26
-	public function __construct(protected EventManagerInterface $event)
27
-	{
28
-		$this->locator = Services::locator();
29
-	}
26
+    public function __construct(protected EventManagerInterface $event)
27
+    {
28
+        $this->locator = Services::locator();
29
+    }
30 30
 
31
-	public function discove()
32
-	{
33
-		$files = $this->locator->listFiles('Events/');
31
+    public function discove()
32
+    {
33
+        $files = $this->locator->listFiles('Events/');
34 34
 
35
-		foreach ($files as $file) {
35
+        foreach ($files as $file) {
36 36
             $className = $this->locator->getClassname($file);
37 37
 
38 38
             if ($className === '' || ! class_exists($className) || ! is_a($className, EventListenerInterface::class, true)) {
39 39
                 continue;
40 40
             }
41 41
 
42
-			Services::factory($className)->listen($this->event);
42
+            Services::factory($className)->listen($this->event);
43 43
         }
44
-	}
44
+    }
45 45
 }
46 46
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
 		foreach ($files as $file) {
36 36
             $className = $this->locator->getClassname($file);
37 37
 
38
-            if ($className === '' || ! class_exists($className) || ! is_a($className, EventListenerInterface::class, true)) {
38
+            if ($className === '' || !class_exists($className) || !is_a($className, EventListenerInterface::class, true)) {
39 39
                 continue;
40 40
             }
41 41
 
Please login to merge, or discard this patch.
src/Core/Application.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@
 block discarded – undo
80 80
 
81 81
     public function run(bool $return_response = false)
82 82
     {
83
-		return Services::singleton(Dispatcher::class)->run(null, $return_response);
83
+        return Services::singleton(Dispatcher::class)->run(null, $return_response);
84 84
     }
85 85
 
86 86
     /**
Please login to merge, or discard this patch.