Passed
Push — master ( 1f77d5...03303d )
by Henri
01:38
created
src/Router.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types = 1);
3
+declare(strict_types=1);
4 4
 
5 5
 namespace HnrAzevedo\Router;
6 6
 
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
     public static function group(string $prefix, \Closure $closure): Router
34 34
     {
35 35
         $id = sha1(date('d/m/Y h:m:i'));
36
-        while(array_key_exists($id, self::getInstance()->groupsName)){
36
+        while (array_key_exists($id, self::getInstance()->groupsName)) {
37 37
             $id = sha1(date('d/m/Y h:m:i').$id);
38 38
         }
39 39
 
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
     {
55 55
         self::getInstance()->loaded = true;
56 56
 
57
-        if(null !== $name){
57
+        if (null !== $name) {
58 58
             return self::getInstance()->loadByName($name);
59 59
         }
60 60
 
@@ -62,15 +62,15 @@  discard block
 block discarded – undo
62 62
 
63 63
         $requestMethod = (isset($_REQUEST['REQUEST_METHOD'])) ? $_REQUEST['REQUEST_METHOD'] : $_SERVER['REQUEST_METHOD'];
64 64
 
65
-        foreach(self::getInstance()->getRoutes() as $r => $route){
65
+        foreach (self::getInstance()->getRoutes() as $r => $route) {
66 66
             self::getInstance()->currentRoute = $route;
67 67
             self::getInstance()->currentRoute['name'] = $r;
68 68
 
69
-            try{
69
+            try {
70 70
                 self::getInstance()->checkMethod($route, $requestMethod);
71 71
                 self::getInstance()->checkData($route, (new Uri($_SERVER['REQUEST_URI']))->getPath());
72 72
                 return self::getInstance();
73
-            }catch(\Exception $er){
73
+            }catch (\Exception $er) {
74 74
                 continue;
75 75
             }
76 76
         }
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 
85 85
     public static function run(?string $name = null): RouterInterface
86 86
     {
87
-        if(!self::getInstance()->loaded){
87
+        if (!self::getInstance()->loaded) {
88 88
             self::getInstance()->load($name);
89 89
         }
90 90
 
@@ -94,9 +94,9 @@  discard block
 block discarded – undo
94 94
 
95 95
         self::getInstance()->executeBefore();
96 96
         
97
-        try{
97
+        try {
98 98
             self::getInstance()->executeRouteAction(self::getInstance()->current()['action']);
99
-        }catch(\Exception $er){
99
+        }catch (\Exception $er) {
100 100
             self::getInstance()->error = $er;
101 101
         }
102 102
         
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 
110 110
     private function checkError(): void
111 111
     {
112
-        if(isset($this->error)){
112
+        if (isset($this->error)) {
113 113
             throw $this->error;
114 114
         }
115 115
     }
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
                 self::getInstance()->checkMethod($route, $requestMethod);
71 71
                 self::getInstance()->checkData($route, (new Uri($_SERVER['REQUEST_URI']))->getPath());
72 72
                 return self::getInstance();
73
-            }catch(\Exception $er){
73
+            } catch(\Exception $er){
74 74
                 continue;
75 75
             }
76 76
         }
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
         
97 97
         try{
98 98
             self::getInstance()->executeRouteAction(self::getInstance()->current()['action']);
99
-        }catch(\Exception $er){
99
+        } catch(\Exception $er){
100 100
             self::getInstance()->error = $er;
101 101
         }
102 102
         
Please login to merge, or discard this patch.