Passed
Push — master ( e6cdc9...c78d0e )
by butschster
06:30 queued 17s
created
src/Framework/Command/Router/ListCommand.php 1 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
                 'head' => '<fg=bright-green>HEAD</>',
@@ -111,7 +117,8 @@  discard block
 block discarded – undo
111 117
     private function getTarget(RouteInterface $route, KernelInterface $kernel): string
112 118
     {
113 119
         $target = $this->getValue($route, 'target');
114
-        switch (true) {
120
+        switch (true)
121
+        {
115 122
             case $target instanceof \Closure:
116 123
                 $reflection = new \ReflectionFunction($target);
117 124
 
@@ -136,7 +143,8 @@  discard block
 block discarded – undo
136 143
 
137 144
             case $target instanceof Group:
138 145
                 $result = [];
139
-                foreach ($this->getValue($target, 'controllers') as $alias => $class) {
146
+                foreach ($this->getValue($target, 'controllers') as $alias => $class)
147
+                {
140 148
                     $result[] = \sprintf('%s => %s', $alias, $this->relativeClass($class, $kernel));
141 149
                 }
142 150
 
@@ -155,10 +163,13 @@  discard block
 block discarded – undo
155 163
 
156 164
     private function getValue(object $object, string $property): mixed
157 165
     {
158
-        try {
166
+        try
167
+        {
159 168
             $r = new \ReflectionObject($object);
160 169
             $prop = $r->getProperty($property);
161
-        } catch (\Throwable $e) {
170
+        }
171
+        catch (\Throwable $e)
172
+        {
162 173
             return $e->getMessage();
163 174
         }
164 175
 
@@ -169,7 +180,8 @@  discard block
 block discarded – undo
169 180
     {
170 181
         $r = new \ReflectionObject($kernel);
171 182
 
172
-        if (\str_starts_with($class, $r->getNamespaceName())) {
183
+        if (\str_starts_with($class, $r->getNamespaceName()))
184
+        {
173 185
             return \substr($class, \strlen($r->getNamespaceName()) + 1);
174 186
         }
175 187
 
Please login to merge, or discard this patch.