Passed
Branch dev (8e1e05)
by Alex
03:51
created
src/Collector.php 1 patch
Braces   +15 added lines, -8 removed lines patch added patch discarded remove patch
@@ -112,7 +112,9 @@  discard block
 block discarded – undo
112 112
             if (strpos($pattern, "{") !== false) {
113 113
                    $index = $this->getDynamicIndex($method, $pattern);
114 114
                    $this->dynamics[$index][$pattern] = $route;
115
-            } else $this->statics[$method][$pattern] = $route;
115
+            } else {
116
+            	$this->statics[$method][$pattern] = $route;
117
+            }
116 118
         }
117 119
 
118 120
         return $group;
@@ -137,8 +139,9 @@  discard block
 block discarded – undo
137 139
     public function match(array $methods, $pattern, $action)
138 140
     {
139 141
         $group = new Group;
140
-        foreach ($methods as $method)
141
-            $group->set($this->set($method, $pattern, $action));
142
+        foreach ($methods as $method) {
143
+                    $group->set($this->set($method, $pattern, $action));
144
+        }
142 145
         return $group;
143 146
     }
144 147
 
@@ -181,8 +184,9 @@  discard block
 block discarded – undo
181 184
     public function group(array $routes)
182 185
     {
183 186
         $group = new Group;
184
-        foreach ($routes as $route)
185
-            $group->set($route);
187
+        foreach ($routes as $route) {
188
+                    $group->set($route);
189
+        }
186 190
         return $group;
187 191
     }
188 192
 
@@ -197,7 +201,9 @@  discard block
 block discarded – undo
197 201
     {
198 202
         if (strpos($pattern, "{") === false) {
199 203
                unset($this->statics[$method][$pattern]);
200
-        } else unset($this->dynamics[$this->getDynamicIndex($method, $pattern)][$pattern]);
204
+        } else {
205
+        	unset($this->dynamics[$this->getDynamicIndex($method, $pattern)][$pattern]);
206
+        }
201 207
     }
202 208
 
203 209
     /**
@@ -210,8 +216,9 @@  discard block
 block discarded – undo
210 216
     public function findStaticRoute($method, $pattern)
211 217
     {
212 218
         $method = strtolower($method);
213
-        if (isset($this->statics[$method]) && isset($this->statics[$method][$pattern]))
214
-            return $this->statics[$method][$pattern];
219
+        if (isset($this->statics[$method]) && isset($this->statics[$method][$pattern])) {
220
+                    return $this->statics[$method][$pattern];
221
+        }
215 222
         return false;
216 223
     }
217 224
 
Please login to merge, or discard this patch.
src/Group.php 1 patch
Braces   +39 added lines, -25 removed lines patch added patch discarded remove patch
@@ -37,9 +37,12 @@  discard block
 block discarded – undo
37 37
     public function set($route)
38 38
     {
39 39
         if ($route instanceof Group) {
40
-            foreach ($route->all() as $r)
41
-                $this->routes[] = $r;
42
-        } else  $this->routes[] = $route;
40
+            foreach ($route->all() as $r) {
41
+                            $this->routes[] = $r;
42
+            }
43
+        } else {
44
+        	$this->routes[] = $route;
45
+        }
43 46
         return  $this;
44 47
     }
45 48
 
@@ -90,8 +93,9 @@  discard block
 block discarded – undo
90 93
 
91 94
     public function forget()
92 95
     {
93
-        foreach ($this->routes as $route)
94
-            $route->forget();
96
+        foreach ($this->routes as $route) {
97
+                    $route->forget();
98
+        }
95 99
         return $this;
96 100
     }
97 101
 
@@ -104,8 +108,9 @@  discard block
 block discarded – undo
104 108
 
105 109
     public function setMethod($method)
106 110
     {
107
-        foreach ($this->routes as $route)
108
-            $route->setMethod($method);
111
+        foreach ($this->routes as $route) {
112
+                    $route->setMethod($method);
113
+        }
109 114
         return $this;
110 115
     }
111 116
 
@@ -118,8 +123,9 @@  discard block
 block discarded – undo
118 123
 
119 124
     public function setAction($action)
120 125
     {
121
-        foreach ($this->routes as $route)
122
-            $route->setAction($action);
126
+        foreach ($this->routes as $route) {
127
+                    $route->setAction($action);
128
+        }
123 129
         return $this;
124 130
     }
125 131
 
@@ -132,8 +138,9 @@  discard block
 block discarded – undo
132 138
 
133 139
     public function setNamespace($namespace)
134 140
     {
135
-        foreach ($this->routes as $route)
136
-            $route->setNamespace($namespace);
141
+        foreach ($this->routes as $route) {
142
+                    $route->setNamespace($namespace);
143
+        }
137 144
         return $this;
138 145
     }
139 146
 
@@ -148,8 +155,9 @@  discard block
 block discarded – undo
148 155
     {
149 156
         $prefix = "/" . ltrim($prefix, "/");
150 157
         $routes = [];
151
-        foreach ($this->routes as $route)
152
-            $routes[] = $route->setPattern(rtrim($prefix . $route->getPattern(), "/"));
158
+        foreach ($this->routes as $route) {
159
+                    $routes[] = $route->setPattern(rtrim($prefix . $route->getPattern(), "/"));
160
+        }
153 161
         $this->routes = $routes;
154 162
         return $this;
155 163
     }
@@ -165,8 +173,9 @@  discard block
 block discarded – undo
165 173
 
166 174
     public function setMetadata($key, $value)
167 175
     {
168
-        foreach ($this->routes as $route)
169
-            $route->setMetadata($key, $value);
176
+        foreach ($this->routes as $route) {
177
+                    $route->setMetadata($key, $value);
178
+        }
170 179
         return $this;
171 180
     }
172 181
 
@@ -179,8 +188,9 @@  discard block
 block discarded – undo
179 188
 
180 189
     public function setMetadataArray(array $metadata)
181 190
     {
182
-        foreach ($this->routes as $route)
183
-            $route->setMetadataArray($metadata);
191
+        foreach ($this->routes as $route) {
192
+                    $route->setMetadataArray($metadata);
193
+        }
184 194
         return $this;
185 195
     }
186 196
 
@@ -193,8 +203,9 @@  discard block
 block discarded – undo
193 203
 
194 204
     public function setDefaults(array $defaults)
195 205
     {
196
-        foreach ($this->routes as $route)
197
-            $route->setDefaults($defaults);
206
+        foreach ($this->routes as $route) {
207
+                    $route->setDefaults($defaults);
208
+        }
198 209
         return $this;
199 210
     }
200 211
 
@@ -209,8 +220,9 @@  discard block
 block discarded – undo
209 220
 
210 221
     public function setDefault($key, $value)
211 222
     {
212
-        foreach ($this->routes as $route)
213
-            $route->setDefault($key, $value);
223
+        foreach ($this->routes as $route) {
224
+                    $route->setDefault($key, $value);
225
+        }
214 226
         return $this;
215 227
     }
216 228
 
@@ -223,8 +235,9 @@  discard block
 block discarded – undo
223 235
 
224 236
     public function setStrategy($strategy)
225 237
     {
226
-        foreach ($this->routes as $route)
227
-            $route->setStrategy($strategy);
238
+        foreach ($this->routes as $route) {
239
+                    $route->setStrategy($strategy);
240
+        }
228 241
         return $this;
229 242
     }
230 243
 
@@ -239,8 +252,9 @@  discard block
 block discarded – undo
239 252
 
240 253
     public function setConstraint($name, $regex)
241 254
     {
242
-        foreach ($this->routes as $route)
243
-            $route->setConstraint($name, $regex);
255
+        foreach ($this->routes as $route) {
256
+                    $route->setConstraint($name, $regex);
257
+        }
244 258
         return $this;
245 259
     }
246 260
 
Please login to merge, or discard this patch.
src/Parser.php 1 patch
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -85,7 +85,9 @@  discard block
 block discarded – undo
85 85
         if ($closingNumber !== count($segments) - 1) {
86 86
             if (preg_match("~" . self::DYNAMIC_REGEX . "(*SKIP)(*F)|\]~x", $withoutClosing)) {
87 87
                    throw new BadRouteException(BadRouteException::OPTIONAL_SEGMENTS_ON_MIDDLE);
88
-            } else throw new BadRouteException(BadRouteException::UNCLOSED_OPTIONAL_SEGMENTS);
88
+            } else {
89
+            	throw new BadRouteException(BadRouteException::UNCLOSED_OPTIONAL_SEGMENTS);
90
+            }
89 91
         }
90 92
     }
91 93
 
@@ -121,8 +123,9 @@  discard block
 block discarded – undo
121 123
     public function getWildcards()
122 124
     {
123 125
         $wildcards = [];
124
-        foreach ($this->wildcards as $token => $regex)
125
-            $wildcards[substr($token, 1)] = substr($regex, 1);
126
+        foreach ($this->wildcards as $token => $regex) {
127
+                    $wildcards[substr($token, 1)] = substr($regex, 1);
128
+        }
126 129
         return $wildcards;
127 130
     }
128 131
 
Please login to merge, or discard this patch.
src/Route.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -167,7 +167,9 @@  discard block
 block discarded – undo
167 167
         if (!is_object($this->strategy)) {
168 168
             if ($container === null) {
169 169
                    $this->strategy = new $this->strategy;
170
-            } else $this->strategy = $container($this->strategy);
170
+            } else {
171
+            	$this->strategy = $container($this->strategy);
172
+            }
171 173
         }
172 174
 
173 175
         return $this->callWithStrategy();
@@ -219,7 +221,9 @@  discard block
 block discarded – undo
219 221
 
220 222
         if ($container === null) {
221 223
                return new $controller;
222
-        } else return $container($controller);
224
+        } else {
225
+        	return $container($controller);
226
+        }
223 227
     }
224 228
 
225 229
     /**
Please login to merge, or discard this patch.