Passed
Push — master ( 4bc14a...9f0e39 )
by Anton
04:36
created
src/Command/Router/ListCommand.php 2 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -42,8 +42,8 @@  discard block
 block discarded – undo
42 42
     {
43 43
         $grid = $this->table(['Name:', 'Verbs:', 'Pattern:', 'Target:']);
44 44
 
45
-        foreach ($router->getRoutes() as $name => $route) {
46
-            if ($route instanceof Route) {
45
+        foreach ($router->getRoutes() as $name => $route){
46
+            if ($route instanceof Route){
47 47
                 $grid->addRow(
48 48
                     [
49 49
                         $name,
@@ -64,14 +64,14 @@  discard block
 block discarded – undo
64 64
      */
65 65
     private function getVerbs(Route $route): string
66 66
     {
67
-        if ($route->getVerbs() === Route::VERBS) {
67
+        if ($route->getVerbs() === Route::VERBS){
68 68
             return '*';
69 69
         }
70 70
 
71 71
         $result = [];
72 72
 
73
-        foreach ($route->getVerbs() as $verb) {
74
-            switch (strtolower($verb)) {
73
+        foreach ($route->getVerbs() as $verb){
74
+            switch (strtolower($verb)){
75 75
                 case 'get':
76 76
                     $verb = '<fg=green>GET</>';
77 77
                     break;
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 
108 108
         return preg_replace_callback(
109 109
             '/<([^>]*)>/',
110
-            static function ($m) {
110
+            static function ($m){
111 111
                 return sprintf('<fg=magenta>%s</>', $m[0]);
112 112
             },
113 113
             $pattern
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
     private function getTarget(Route $route, KernelInterface $kernel): string
125 125
     {
126 126
         $target = $this->getValue($route, 'target');
127
-        switch (true) {
127
+        switch (true){
128 128
             case $target instanceof Closure:
129 129
                 $reflection = new ReflectionFunction($target);
130 130
                 return sprintf(
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
                 return sprintf(
138 138
                     '%s->%s',
139 139
                     $this->relativeClass($this->getValue($target, 'controller'), $kernel),
140
-                    join('|', (array) $this->getValue($target, 'action'))
140
+                    join('|', (array)$this->getValue($target, 'action'))
141 141
                 );
142 142
 
143 143
             case $target instanceof Controller:
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 
149 149
             case $target instanceof Group:
150 150
                 $result = [];
151
-                foreach ($this->getValue($target, 'controllers') as $alias => $class) {
151
+                foreach ($this->getValue($target, 'controllers') as $alias => $class){
152 152
                     $result[] = sprintf('%s => %s', $alias, $this->relativeClass($class, $kernel));
153 153
                 }
154 154
 
@@ -174,11 +174,11 @@  discard block
 block discarded – undo
174 174
      */
175 175
     private function getValue(object $object, string $property)
176 176
     {
177
-        try {
177
+        try{
178 178
             $r = new ReflectionObject($object);
179 179
             $prop = $r->getProperty($property);
180 180
             $prop->setAccessible(true);
181
-        } catch (Throwable $e) {
181
+        }catch (Throwable $e){
182 182
             return $e->getMessage();
183 183
         }
184 184
 
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
         $r = new ReflectionObject($kernel);
196 196
         $r->getNamespaceName();
197 197
 
198
-        if (strpos($class, $r->getNamespaceName()) === 0) {
198
+        if (strpos($class, $r->getNamespaceName()) === 0){
199 199
             return substr($class, strlen($r->getNamespaceName()) + 1);
200 200
         }
201 201
 
Please login to merge, or discard this patch.
Braces   +23 added lines, -11 removed lines patch added patch discarded remove patch
@@ -42,8 +42,10 @@  discard block
 block discarded – undo
42 42
     {
43 43
         $grid = $this->table(['Name:', 'Verbs:', 'Pattern:', 'Target:']);
44 44
 
45
-        foreach ($router->getRoutes() as $name => $route) {
46
-            if ($route instanceof Route) {
45
+        foreach ($router->getRoutes() as $name => $route)
46
+        {
47
+            if ($route instanceof Route)
48
+            {
47 49
                 $grid->addRow(
48 50
                     [
49 51
                         $name,
@@ -64,14 +66,17 @@  discard block
 block discarded – undo
64 66
      */
65 67
     private function getVerbs(Route $route): string
66 68
     {
67
-        if ($route->getVerbs() === Route::VERBS) {
69
+        if ($route->getVerbs() === Route::VERBS)
70
+        {
68 71
             return '*';
69 72
         }
70 73
 
71 74
         $result = [];
72 75
 
73
-        foreach ($route->getVerbs() as $verb) {
74
-            switch (strtolower($verb)) {
76
+        foreach ($route->getVerbs() as $verb)
77
+        {
78
+            switch (strtolower($verb))
79
+            {
75 80
                 case 'get':
76 81
                     $verb = '<fg=green>GET</>';
77 82
                     break;
@@ -107,7 +112,8 @@  discard block
 block discarded – undo
107 112
 
108 113
         return preg_replace_callback(
109 114
             '/<([^>]*)>/',
110
-            static function ($m) {
115
+            static function ($m)
116
+            {
111 117
                 return sprintf('<fg=magenta>%s</>', $m[0]);
112 118
             },
113 119
             $pattern
@@ -124,7 +130,8 @@  discard block
 block discarded – undo
124 130
     private function getTarget(Route $route, KernelInterface $kernel): string
125 131
     {
126 132
         $target = $this->getValue($route, 'target');
127
-        switch (true) {
133
+        switch (true)
134
+        {
128 135
             case $target instanceof Closure:
129 136
                 $reflection = new ReflectionFunction($target);
130 137
                 return sprintf(
@@ -148,7 +155,8 @@  discard block
 block discarded – undo
148 155
 
149 156
             case $target instanceof Group:
150 157
                 $result = [];
151
-                foreach ($this->getValue($target, 'controllers') as $alias => $class) {
158
+                foreach ($this->getValue($target, 'controllers') as $alias => $class)
159
+                {
152 160
                     $result[] = sprintf('%s => %s', $alias, $this->relativeClass($class, $kernel));
153 161
                 }
154 162
 
@@ -174,11 +182,14 @@  discard block
 block discarded – undo
174 182
      */
175 183
     private function getValue(object $object, string $property)
176 184
     {
177
-        try {
185
+        try
186
+        {
178 187
             $r = new ReflectionObject($object);
179 188
             $prop = $r->getProperty($property);
180 189
             $prop->setAccessible(true);
181
-        } catch (Throwable $e) {
190
+        }
191
+        catch (Throwable $e)
192
+        {
182 193
             return $e->getMessage();
183 194
         }
184 195
 
@@ -195,7 +206,8 @@  discard block
 block discarded – undo
195 206
         $r = new ReflectionObject($kernel);
196 207
         $r->getNamespaceName();
197 208
 
198
-        if (strpos($class, $r->getNamespaceName()) === 0) {
209
+        if (strpos($class, $r->getNamespaceName()) === 0)
210
+        {
199 211
             return substr($class, strlen($r->getNamespaceName()) + 1);
200 212
         }
201 213
 
Please login to merge, or discard this patch.