Passed
Push — master ( 3db2bb...2c780f )
by butschster
10:24 queued 15s
created
src/Framework/Command/Router/ListCommand.php 2 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -28,8 +28,8 @@  discard block
 block discarded – undo
28 28
     {
29 29
         $grid = $this->table(['Name:', 'Verbs:', 'Pattern:', 'Target:', 'Group:']);
30 30
 
31
-        foreach ($router->getRoutes() as $name => $route) {
32
-            if ($route instanceof RouteInterface) {
31
+        foreach ($router->getRoutes() as $name => $route){
32
+            if ($route instanceof RouteInterface){
33 33
                 $grid->addRow(
34 34
                     [
35 35
                         $name,
@@ -53,8 +53,8 @@  discard block
 block discarded – undo
53 53
     private function getRouteGroups(GroupRegistry $registry, string $routeName): array
54 54
     {
55 55
         $groups = [];
56
-        foreach ($registry as $groupName => $group) {
57
-            if ($group->hasRoute($routeName)) {
56
+        foreach ($registry as $groupName => $group){
57
+            if ($group->hasRoute($routeName)){
58 58
                 $groups[] = $groupName;
59 59
             }
60 60
         }
@@ -64,12 +64,12 @@  discard block
 block discarded – undo
64 64
 
65 65
     private function getVerbs(RouteInterface $route): string
66 66
     {
67
-        if ($route->getVerbs() === RouteInterface::VERBS) {
67
+        if ($route->getVerbs() === RouteInterface::VERBS){
68 68
             return '*';
69 69
         }
70 70
 
71 71
         $result = [];
72
-        foreach ($route->getVerbs() as $verb) {
72
+        foreach ($route->getVerbs() as $verb){
73 73
             $result[] = match (\strtolower($verb)) {
74 74
                 'get' => '<fg=green>GET</>',
75 75
                 'post' => '<fg=blue>POST</>',
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
         $pattern = \preg_replace_callback(
97 97
             '/<([^>]*)>/',
98 98
             static fn ($m) => \sprintf('<fg=magenta>%s</>', $m[0]),
99
-            !empty($prefix) ? $prefix . '/' . \trim($pattern, '/') : $pattern
99
+            !empty($prefix) ? $prefix.'/'.\trim($pattern, '/') : $pattern
100 100
         );
101 101
 
102 102
         return $pattern;
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
     private function getTarget(RouteInterface $route, KernelInterface $kernel): string
110 110
     {
111 111
         $target = $this->getValue($route, 'target');
112
-        switch (true) {
112
+        switch (true){
113 113
             case $target instanceof \Closure:
114 114
                 $reflection = new \ReflectionFunction($target);
115 115
 
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 
135 135
             case $target instanceof Group:
136 136
                 $result = [];
137
-                foreach ($this->getValue($target, 'controllers') as $alias => $class) {
137
+                foreach ($this->getValue($target, 'controllers') as $alias => $class){
138 138
                     $result[] = \sprintf('%s => %s', $alias, $this->relativeClass($class, $kernel));
139 139
                 }
140 140
 
@@ -153,10 +153,10 @@  discard block
 block discarded – undo
153 153
 
154 154
     private function getValue(object $object, string $property): mixed
155 155
     {
156
-        try {
156
+        try{
157 157
             $r = new \ReflectionObject($object);
158 158
             $prop = $r->getProperty($property);
159
-        } catch (\Throwable $e) {
159
+        }catch (\Throwable $e){
160 160
             return $e->getMessage();
161 161
         }
162 162
 
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
     {
168 168
         $r = new \ReflectionObject($kernel);
169 169
 
170
-        if (\str_starts_with($class, $r->getNamespaceName())) {
170
+        if (\str_starts_with($class, $r->getNamespaceName())){
171 171
             return \substr($class, \strlen($r->getNamespaceName()) + 1);
172 172
         }
173 173
 
Please login to merge, or discard this patch.
Braces   +23 added lines, -11 removed lines patch added patch discarded remove patch
@@ -28,8 +28,10 @@  discard block
 block discarded – undo
28 28
     {
29 29
         $grid = $this->table(['Name:', 'Verbs:', 'Pattern:', 'Target:', 'Group:']);
30 30
 
31
-        foreach ($router->getRoutes() as $name => $route) {
32
-            if ($route instanceof RouteInterface) {
31
+        foreach ($router->getRoutes() as $name => $route)
32
+        {
33
+            if ($route instanceof RouteInterface)
34
+            {
33 35
                 $grid->addRow(
34 36
                     [
35 37
                         $name,
@@ -53,8 +55,10 @@  discard block
 block discarded – undo
53 55
     private function getRouteGroups(GroupRegistry $registry, string $routeName): array
54 56
     {
55 57
         $groups = [];
56
-        foreach ($registry as $groupName => $group) {
57
-            if ($group->hasRoute($routeName)) {
58
+        foreach ($registry as $groupName => $group)
59
+        {
60
+            if ($group->hasRoute($routeName))
61
+            {
58 62
                 $groups[] = $groupName;
59 63
             }
60 64
         }
@@ -64,12 +68,14 @@  discard block
 block discarded – undo
64 68
 
65 69
     private function getVerbs(RouteInterface $route): string
66 70
     {
67
-        if ($route->getVerbs() === RouteInterface::VERBS) {
71
+        if ($route->getVerbs() === RouteInterface::VERBS)
72
+        {
68 73
             return '*';
69 74
         }
70 75
 
71 76
         $result = [];
72
-        foreach ($route->getVerbs() as $verb) {
77
+        foreach ($route->getVerbs() as $verb)
78
+        {
73 79
             $result[] = match (\strtolower($verb)) {
74 80
                 'get' => '<fg=green>GET</>',
75 81
                 'post' => '<fg=blue>POST</>',
@@ -109,7 +115,8 @@  discard block
 block discarded – undo
109 115
     private function getTarget(RouteInterface $route, KernelInterface $kernel): string
110 116
     {
111 117
         $target = $this->getValue($route, 'target');
112
-        switch (true) {
118
+        switch (true)
119
+        {
113 120
             case $target instanceof \Closure:
114 121
                 $reflection = new \ReflectionFunction($target);
115 122
 
@@ -134,7 +141,8 @@  discard block
 block discarded – undo
134 141
 
135 142
             case $target instanceof Group:
136 143
                 $result = [];
137
-                foreach ($this->getValue($target, 'controllers') as $alias => $class) {
144
+                foreach ($this->getValue($target, 'controllers') as $alias => $class)
145
+                {
138 146
                     $result[] = \sprintf('%s => %s', $alias, $this->relativeClass($class, $kernel));
139 147
                 }
140 148
 
@@ -153,10 +161,13 @@  discard block
 block discarded – undo
153 161
 
154 162
     private function getValue(object $object, string $property): mixed
155 163
     {
156
-        try {
164
+        try
165
+        {
157 166
             $r = new \ReflectionObject($object);
158 167
             $prop = $r->getProperty($property);
159
-        } catch (\Throwable $e) {
168
+        }
169
+        catch (\Throwable $e)
170
+        {
160 171
             return $e->getMessage();
161 172
         }
162 173
 
@@ -167,7 +178,8 @@  discard block
 block discarded – undo
167 178
     {
168 179
         $r = new \ReflectionObject($kernel);
169 180
 
170
-        if (\str_starts_with($class, $r->getNamespaceName())) {
181
+        if (\str_starts_with($class, $r->getNamespaceName()))
182
+        {
171 183
             return \substr($class, \strlen($r->getNamespaceName()) + 1);
172 184
         }
173 185
 
Please login to merge, or discard this patch.