Passed
Branch v2-dev (66ec62)
by Henri
01:21
created
src/Router.php 1 patch
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,21 +54,21 @@  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
 
61 61
         self::getInstance()->sortRoutes();
62 62
 
63
-        foreach(self::getInstance()->getRoutes() as $r => $route){
63
+        foreach (self::getInstance()->getRoutes() as $r => $route) {
64 64
             self::getInstance()->currentRoute = $route;
65 65
             self::getInstance()->currentRoute['name'] = $r;
66 66
 
67
-            try{
67
+            try {
68 68
                 self::getInstance()->checkMethod($route, $_SERVER['REQUEST_METHOD']);
69 69
                 self::getInstance()->checkData($route, (new Uri($_SERVER['REQUEST_URI']))->getPath());
70 70
                 return self::getInstance();
71
-            }catch(\Exception $er){
71
+            }catch (\Exception $er) {
72 72
                 continue;
73 73
             }
74 74
         }
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 
83 83
     public static function run(?string $name = null): RouterInterface
84 84
     {
85
-        if(!self::getInstance()->loaded){
85
+        if (!self::getInstance()->loaded) {
86 86
             self::getInstance()->load($name);
87 87
         }
88 88
 
@@ -92,9 +92,9 @@  discard block
 block discarded – undo
92 92
 
93 93
         self::getInstance()->executeBefore();
94 94
         
95
-        try{
95
+        try {
96 96
             self::getInstance()->executeRouteAction(self::getInstance()->current()['action']);
97
-        }catch(\Exception $er){
97
+        }catch (\Exception $er) {
98 98
             self::getInstance()->error = $er;
99 99
         }
100 100
         
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 
108 108
     private function checkError(): void
109 109
     {
110
-        if(isset($this->error)){
110
+        if (isset($this->error)) {
111 111
             throw $this->error;
112 112
         }
113 113
     }
Please login to merge, or discard this patch.