@@ -117,7 +117,9 @@ discard block |
||
| 117 | 117 | if (strpos($pattern, "{") !== false) { |
| 118 | 118 | $index = $this->getDynamicIndex($method, $pattern); |
| 119 | 119 | $this->dynamics[$index][$pattern] = $route; |
| 120 | - } else $this->statics[$method][$pattern] = $route; |
|
| 120 | + } else { |
|
| 121 | + $this->statics[$method][$pattern] = $route; |
|
| 122 | + } |
|
| 121 | 123 | } |
| 122 | 124 | |
| 123 | 125 | return new Group($group); |
@@ -142,8 +144,9 @@ discard block |
||
| 142 | 144 | public function match(array $methods, $pattern, $action) |
| 143 | 145 | { |
| 144 | 146 | $group = []; |
| 145 | - foreach ($methods as $method) |
|
| 146 | - $group[] = $this->set($method, $pattern, $action); |
|
| 147 | + foreach ($methods as $method) { |
|
| 148 | + $group[] = $this->set($method, $pattern, $action); |
|
| 149 | + } |
|
| 147 | 150 | return new Group($group); |
| 148 | 151 | } |
| 149 | 152 | |
@@ -186,8 +189,9 @@ discard block |
||
| 186 | 189 | public function group(array $routes) |
| 187 | 190 | { |
| 188 | 191 | $group = []; |
| 189 | - foreach ($routes as $route) |
|
| 190 | - $group[] = $route; |
|
| 192 | + foreach ($routes as $route) { |
|
| 193 | + $group[] = $route; |
|
| 194 | + } |
|
| 191 | 195 | return new Group($group); |
| 192 | 196 | } |
| 193 | 197 | |
@@ -202,7 +206,9 @@ discard block |
||
| 202 | 206 | { |
| 203 | 207 | if (strpos($pattern, "{") === false) { |
| 204 | 208 | unset($this->statics[$method][$pattern]); |
| 205 | - } else unset($this->dynamics[$this->getDynamicIndex($method, $pattern)][$pattern]); |
|
| 209 | + } else { |
|
| 210 | + unset($this->dynamics[$this->getDynamicIndex($method, $pattern)][$pattern]); |
|
| 211 | + } |
|
| 206 | 212 | } |
| 207 | 213 | |
| 208 | 214 | /** |
@@ -257,7 +263,9 @@ discard block |
||
| 257 | 263 | if ($closingNumber !== count($segments) - 1) { |
| 258 | 264 | if (preg_match("~" . self::DYNAMIC_REGEX . "(*SKIP)(*F)|\]~x", $withoutClosing)) { |
| 259 | 265 | throw new BadRouteException(BadRouteException::OPTIONAL_SEGMENTS_ON_MIDDLE); |
| 260 | - } else throw new BadRouteException(BadRouteException::UNCLOSED_OPTIONAL_SEGMENTS); |
|
| 266 | + } else { |
|
| 267 | + throw new BadRouteException(BadRouteException::UNCLOSED_OPTIONAL_SEGMENTS); |
|
| 268 | + } |
|
| 261 | 269 | } |
| 262 | 270 | } |
| 263 | 271 | |
@@ -301,8 +309,9 @@ discard block |
||
| 301 | 309 | public function findStaticRoute($method, $pattern) |
| 302 | 310 | { |
| 303 | 311 | $method = strtolower($method); |
| 304 | - if (isset($this->statics[$method]) && isset($this->statics[$method][$pattern])) |
|
| 305 | - return $this->statics[$method][$pattern]; |
|
| 312 | + if (isset($this->statics[$method]) && isset($this->statics[$method][$pattern])) { |
|
| 313 | + return $this->statics[$method][$pattern]; |
|
| 314 | + } |
|
| 306 | 315 | return false; |
| 307 | 316 | } |
| 308 | 317 | |
@@ -69,8 +69,9 @@ discard block |
||
| 69 | 69 | public function controllers(array $controllers) |
| 70 | 70 | { |
| 71 | 71 | $group = []; |
| 72 | - foreach ($controllers as $controller) |
|
| 73 | - $group[] = $this->controller($controller); |
|
| 72 | + foreach ($controllers as $controller) { |
|
| 73 | + $group[] = $this->controller($controller); |
|
| 74 | + } |
|
| 74 | 75 | return new Group($group); |
| 75 | 76 | } |
| 76 | 77 | |
@@ -100,8 +101,9 @@ discard block |
||
| 100 | 101 | public function controllersWithoutPrefix(array $controllers) |
| 101 | 102 | { |
| 102 | 103 | $group = []; |
| 103 | - foreach ($controllers as $controller) |
|
| 104 | - $group[] = $this->controllerWithoutPrefix($controller); |
|
| 104 | + foreach ($controllers as $controller) { |
|
| 105 | + $group[] = $this->controllerWithoutPrefix($controller); |
|
| 106 | + } |
|
| 105 | 107 | return new Group($group); |
| 106 | 108 | } |
| 107 | 109 | |
@@ -76,8 +76,9 @@ |
||
| 76 | 76 | public function resources(array $controllers) |
| 77 | 77 | { |
| 78 | 78 | $resource = new Resource; |
| 79 | - foreach ($controllers as $controller) |
|
| 80 | - $resource->set($this->resource($controller)); |
|
| 79 | + foreach ($controllers as $controller) { |
|
| 80 | + $resource->set($this->resource($controller)); |
|
| 81 | + } |
|
| 81 | 82 | return $resource; |
| 82 | 83 | } |
| 83 | 84 | |
@@ -48,9 +48,12 @@ discard block |
||
| 48 | 48 | public function set($route) |
| 49 | 49 | { |
| 50 | 50 | if ($route instanceof Group) { |
| 51 | - foreach ($route->all() as $r) |
|
| 52 | - $this->routes[] = $r; |
|
| 53 | - } else $this->routes[] = $route; |
|
| 51 | + foreach ($route->all() as $r) { |
|
| 52 | + $this->routes[] = $r; |
|
| 53 | + } |
|
| 54 | + } else { |
|
| 55 | + $this->routes[] = $route; |
|
| 56 | + } |
|
| 54 | 57 | return $this; |
| 55 | 58 | } |
| 56 | 59 | |
@@ -88,8 +91,9 @@ discard block |
||
| 88 | 91 | |
| 89 | 92 | public function forget() |
| 90 | 93 | { |
| 91 | - foreach ($this->routes as $route) |
|
| 92 | - $route->forget(); |
|
| 94 | + foreach ($this->routes as $route) { |
|
| 95 | + $route->forget(); |
|
| 96 | + } |
|
| 93 | 97 | return $this; |
| 94 | 98 | } |
| 95 | 99 | |
@@ -102,8 +106,9 @@ discard block |
||
| 102 | 106 | |
| 103 | 107 | public function setMethod($method) |
| 104 | 108 | { |
| 105 | - foreach ($this->routes as $route) |
|
| 106 | - $route->setMethod($method); |
|
| 109 | + foreach ($this->routes as $route) { |
|
| 110 | + $route->setMethod($method); |
|
| 111 | + } |
|
| 107 | 112 | return $this; |
| 108 | 113 | } |
| 109 | 114 | |
@@ -116,8 +121,9 @@ discard block |
||
| 116 | 121 | |
| 117 | 122 | public function setAction($action) |
| 118 | 123 | { |
| 119 | - foreach ($this->routes as $route) |
|
| 120 | - $route->setAction($action); |
|
| 124 | + foreach ($this->routes as $route) { |
|
| 125 | + $route->setAction($action); |
|
| 126 | + } |
|
| 121 | 127 | return $this; |
| 122 | 128 | } |
| 123 | 129 | |
@@ -130,8 +136,9 @@ discard block |
||
| 130 | 136 | |
| 131 | 137 | public function setNamespace($namespace) |
| 132 | 138 | { |
| 133 | - foreach ($this->routes as $route) |
|
| 134 | - $route->setNamespace($namespace); |
|
| 139 | + foreach ($this->routes as $route) { |
|
| 140 | + $route->setNamespace($namespace); |
|
| 141 | + } |
|
| 135 | 142 | return $this; |
| 136 | 143 | } |
| 137 | 144 | |
@@ -145,8 +152,9 @@ discard block |
||
| 145 | 152 | public function setPrefix($prefix) |
| 146 | 153 | { |
| 147 | 154 | $prefix = "/" . ltrim($prefix, "/"); |
| 148 | - foreach ($this->routes as $route) |
|
| 149 | - $route->setPattern(rtrim($prefix . $route->getPattern(), "/")); |
|
| 155 | + foreach ($this->routes as $route) { |
|
| 156 | + $route->setPattern(rtrim($prefix . $route->getPattern(), "/")); |
|
| 157 | + } |
|
| 150 | 158 | return $this; |
| 151 | 159 | } |
| 152 | 160 | |
@@ -161,8 +169,9 @@ discard block |
||
| 161 | 169 | |
| 162 | 170 | public function setMetadata($key, $value) |
| 163 | 171 | { |
| 164 | - foreach ($this->routes as $route) |
|
| 165 | - $route->setMetadata($key, $value); |
|
| 172 | + foreach ($this->routes as $route) { |
|
| 173 | + $route->setMetadata($key, $value); |
|
| 174 | + } |
|
| 166 | 175 | return $this; |
| 167 | 176 | } |
| 168 | 177 | |
@@ -175,8 +184,9 @@ discard block |
||
| 175 | 184 | |
| 176 | 185 | public function setMetadataArray(array $metadata) |
| 177 | 186 | { |
| 178 | - foreach ($this->routes as $route) |
|
| 179 | - $route->setMetadataArray($metadata); |
|
| 187 | + foreach ($this->routes as $route) { |
|
| 188 | + $route->setMetadataArray($metadata); |
|
| 189 | + } |
|
| 180 | 190 | return $this; |
| 181 | 191 | } |
| 182 | 192 | |
@@ -189,8 +199,9 @@ discard block |
||
| 189 | 199 | |
| 190 | 200 | public function setDefaults(array $defaults) |
| 191 | 201 | { |
| 192 | - foreach ($this->routes as $route) |
|
| 193 | - $route->setDefaults($defaults); |
|
| 202 | + foreach ($this->routes as $route) { |
|
| 203 | + $route->setDefaults($defaults); |
|
| 204 | + } |
|
| 194 | 205 | return $this; |
| 195 | 206 | } |
| 196 | 207 | |
@@ -205,8 +216,9 @@ discard block |
||
| 205 | 216 | |
| 206 | 217 | public function setDefault($key, $value) |
| 207 | 218 | { |
| 208 | - foreach ($this->routes as $route) |
|
| 209 | - $route->setDefault($key, $value); |
|
| 219 | + foreach ($this->routes as $route) { |
|
| 220 | + $route->setDefault($key, $value); |
|
| 221 | + } |
|
| 210 | 222 | return $this; |
| 211 | 223 | } |
| 212 | 224 | |
@@ -219,8 +231,9 @@ discard block |
||
| 219 | 231 | |
| 220 | 232 | public function setStrategy($strategy) |
| 221 | 233 | { |
| 222 | - foreach ($this->routes as $route) |
|
| 223 | - $route->setStrategy($strategy); |
|
| 234 | + foreach ($this->routes as $route) { |
|
| 235 | + $route->setStrategy($strategy); |
|
| 236 | + } |
|
| 224 | 237 | return $this; |
| 225 | 238 | } |
| 226 | 239 | |
@@ -173,7 +173,9 @@ |
||
| 173 | 173 | foreach ($segments as $index => $segment) { |
| 174 | 174 | if (strpos($segment, "{") === 0) { |
| 175 | 175 | $pattern .= "/{" . $segments[$index - 1] . "_" . ltrim($segment, "{"); |
| 176 | - } else $pattern .= $segment; |
|
| 176 | + } else { |
|
| 177 | + $pattern .= $segment; |
|
| 178 | + } |
|
| 177 | 179 | } |
| 178 | 180 | |
| 179 | 181 | return $pattern; |
@@ -219,7 +219,9 @@ |
||
| 219 | 219 | if (is_string($callable[0])) { |
| 220 | 220 | $callable[0] = rtrim($this->namespace, "\\") . "\\" . $this->parseCallablePlaceholders($callable[0]); |
| 221 | 221 | $callable[1] = $this->parseCallablePlaceholders($callable[1]); |
| 222 | - } else $callable[1] = $this->parseCallablePlaceholders($callable[1]); |
|
| 222 | + } else { |
|
| 223 | + $callable[1] = $this->parseCallablePlaceholders($callable[1]); |
|
| 224 | + } |
|
| 223 | 225 | } |
| 224 | 226 | |
| 225 | 227 | return $callable; |
@@ -41,7 +41,9 @@ |
||
| 41 | 41 | { |
| 42 | 42 | if ($route->hasMetadata($this->metadataStrategyKey)) { |
| 43 | 43 | $route->setStrategy($route->getMetadata($this->metadataStrategyKey)); |
| 44 | - } else $route->setStrategy(null); |
|
| 44 | + } else { |
|
| 45 | + $route->setStrategy(null); |
|
| 46 | + } |
|
| 45 | 47 | |
| 46 | 48 | $this->enhance($route); |
| 47 | 49 | |