@@ -25,7 +25,7 @@ discard block  | 
                                                    ||
| 25 | 25 | 'integer' => '\d+',  | 
                                                        
| 26 | 26 |          'uuid'    => '[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}', | 
                                                        
| 27 | 27 | ];  | 
                                                        
| 28 | - private const URI_FIXERS = [  | 
                                                        |
| 28 | + private const URI_FIXERS = [  | 
                                                        |
| 29 | 29 | '[]' => '',  | 
                                                        
| 30 | 30 | '[/]' => '',  | 
                                                        
| 31 | 31 | '[' => '',  | 
                                                        
@@ -50,7 +50,7 @@ discard block  | 
                                                    ||
| 50 | 50 | public function __construct(  | 
                                                        
| 51 | 51 | private readonly UriFactoryInterface $uriFactory,  | 
                                                        
| 52 | 52 | SlugifyInterface $slugify = null  | 
                                                        
| 53 | -    ) { | 
                                                        |
| 53 | +    ){ | 
                                                        |
| 54 | 54 | $this->slugify = $slugify ?? new Slugify();  | 
                                                        
| 55 | 55 | }  | 
                                                        
| 56 | 56 | |
@@ -90,7 +90,7 @@ discard block  | 
                                                    ||
| 90 | 90 | |
| 91 | 91 | public function withBasePath(string $basePath): self  | 
                                                        
| 92 | 92 |      { | 
                                                        
| 93 | -        if (!\str_ends_with($basePath, '/')) { | 
                                                        |
| 93 | +        if (!\str_ends_with($basePath, '/')){ | 
                                                        |
| 94 | 94 | $basePath .= '/';  | 
                                                        
| 95 | 95 | }  | 
                                                        
| 96 | 96 | |
@@ -127,12 +127,12 @@ discard block  | 
                                                    ||
| 127 | 127 | */  | 
                                                        
| 128 | 128 | public function match(UriInterface $uri, array $defaults): ?array  | 
                                                        
| 129 | 129 |      { | 
                                                        
| 130 | -        if (!$this->isCompiled()) { | 
                                                        |
| 130 | +        if (!$this->isCompiled()){ | 
                                                        |
| 131 | 131 | $this->compile();  | 
                                                        
| 132 | 132 | }  | 
                                                        
| 133 | 133 | |
| 134 | 134 | $matches = [];  | 
                                                        
| 135 | -        if (!\preg_match($this->compiled, $this->fetchTarget($uri), $matches)) { | 
                                                        |
| 135 | +        if (!\preg_match($this->compiled, $this->fetchTarget($uri), $matches)){ | 
                                                        |
| 136 | 136 | return null;  | 
                                                        
| 137 | 137 | }  | 
                                                        
| 138 | 138 | |
@@ -149,7 +149,7 @@ discard block  | 
                                                    ||
| 149 | 149 | */  | 
                                                        
| 150 | 150 | public function uri(iterable $parameters = [], array $defaults = []): UriInterface  | 
                                                        
| 151 | 151 |      { | 
                                                        
| 152 | -        if (!$this->isCompiled()) { | 
                                                        |
| 152 | +        if (!$this->isCompiled()){ | 
                                                        |
| 153 | 153 | $this->compile();  | 
                                                        
| 154 | 154 | }  | 
                                                        
| 155 | 155 | |
@@ -159,8 +159,8 @@ discard block  | 
                                                    ||
| 159 | 159 | $this->fetchOptions($parameters, $query)  | 
                                                        
| 160 | 160 | );  | 
                                                        
| 161 | 161 | |
| 162 | -        foreach ($this->constrains as $key => $_) { | 
                                                        |
| 163 | -            if (empty($parameters[$key])) { | 
                                                        |
| 162 | +        foreach ($this->constrains as $key => $_){ | 
                                                        |
| 163 | +            if (empty($parameters[$key])){ | 
                                                        |
| 164 | 164 |                  throw new UriHandlerException(\sprintf('Unable to generate Uri, parameter `%s` is missing', $key)); | 
                                                        
| 165 | 165 | }  | 
                                                        
| 166 | 166 | }  | 
                                                        
@@ -169,7 +169,7 @@ discard block  | 
                                                    ||
| 169 | 169 | $path = $this->interpolate($this->template, $parameters);  | 
                                                        
| 170 | 170 | |
| 171 | 171 | //Uri with added base path and prefix  | 
                                                        
| 172 | - $uri = $this->uriFactory->createUri(($this->matchHost ? '' : $this->basePath) . \trim($path, '/'));  | 
                                                        |
| 172 | + $uri = $this->uriFactory->createUri(($this->matchHost ? '' : $this->basePath).\trim($path, '/'));  | 
                                                        |
| 173 | 173 | |
| 174 | 174 | return empty($query) ? $uri : $uri->withQuery(\http_build_query($query));  | 
                                                        
| 175 | 175 | }  | 
                                                        
@@ -184,18 +184,18 @@ discard block  | 
                                                    ||
| 184 | 184 | $allowed = \array_keys($this->options);  | 
                                                        
| 185 | 185 | |
| 186 | 186 | $result = [];  | 
                                                        
| 187 | -        foreach ($parameters as $key => $parameter) { | 
                                                        |
| 188 | -            if (\is_int($key) && isset($allowed[$key])) { | 
                                                        |
| 187 | +        foreach ($parameters as $key => $parameter){ | 
                                                        |
| 188 | +            if (\is_int($key) && isset($allowed[$key])){ | 
                                                        |
| 189 | 189 | // this segment fetched keys from given parameters either by name or by position  | 
                                                        
| 190 | 190 | $key = $allowed[$key];  | 
                                                        
| 191 | -            } elseif (!\array_key_exists($key, $this->options) && \is_array($parameters)) { | 
                                                        |
| 191 | +            } elseif (!\array_key_exists($key, $this->options) && \is_array($parameters)){ | 
                                                        |
| 192 | 192 | // all additional parameters given in array form can be glued to query string  | 
                                                        
| 193 | 193 | $query[$key] = $parameter;  | 
                                                        
| 194 | 194 | continue;  | 
                                                        
| 195 | 195 | }  | 
                                                        
| 196 | 196 | |
| 197 | 197 | //String must be normalized here  | 
                                                        
| 198 | -            if (\is_string($parameter) && !\preg_match('/^[a-z\-_0-9]+$/i', $parameter)) { | 
                                                        |
| 198 | +            if (\is_string($parameter) && !\preg_match('/^[a-z\-_0-9]+$/i', $parameter)){ | 
                                                        |
| 199 | 199 | $result[$key] = $this->slugify->slugify($parameter);  | 
                                                        
| 200 | 200 | continue;  | 
                                                        
| 201 | 201 | }  | 
                                                        
@@ -213,15 +213,15 @@ discard block  | 
                                                    ||
| 213 | 213 |      { | 
                                                        
| 214 | 214 | $path = $uri->getPath();  | 
                                                        
| 215 | 215 | |
| 216 | -        if (empty($path) || $path[0] !== '/') { | 
                                                        |
| 217 | - $path = '/' . $path;  | 
                                                        |
| 216 | +        if (empty($path) || $path[0] !== '/'){ | 
                                                        |
| 217 | + $path = '/'.$path;  | 
                                                        |
| 218 | 218 | }  | 
                                                        
| 219 | 219 | |
| 220 | -        if ($this->matchHost) { | 
                                                        |
| 221 | - $uriString = $uri->getHost() . $path;  | 
                                                        |
| 222 | -        } else { | 
                                                        |
| 220 | +        if ($this->matchHost){ | 
                                                        |
| 221 | + $uriString = $uri->getHost().$path;  | 
                                                        |
| 222 | +        }else{ | 
                                                        |
| 223 | 223 | $uriString = \substr($path, \strlen($this->basePath));  | 
                                                        
| 224 | -            if ($uriString === false) { | 
                                                        |
| 224 | +            if ($uriString === false){ | 
                                                        |
| 225 | 225 | $uriString = '';  | 
                                                        
| 226 | 226 | }  | 
                                                        
| 227 | 227 | }  | 
                                                        
@@ -234,23 +234,23 @@ discard block  | 
                                                    ||
| 234 | 234 | */  | 
                                                        
| 235 | 235 | private function compile(): void  | 
                                                        
| 236 | 236 |      { | 
                                                        
| 237 | -        if ($this->pattern === null) { | 
                                                        |
| 237 | +        if ($this->pattern === null){ | 
                                                        |
| 238 | 238 |              throw new UriHandlerException('Unable to compile UriHandler, pattern is not set'); | 
                                                        
| 239 | 239 | }  | 
                                                        
| 240 | 240 | |
| 241 | 241 | $options = [];  | 
                                                        
| 242 | 242 | $replaces = [];  | 
                                                        
| 243 | - $pattern = \rtrim(\ltrim($this->getPrefix() . '/' . $this->pattern, ':/'), '/');  | 
                                                        |
| 243 | + $pattern = \rtrim(\ltrim($this->getPrefix().'/'.$this->pattern, ':/'), '/');  | 
                                                        |
| 244 | 244 | |
| 245 | 245 | // correct [/ first occurrence]  | 
                                                        
| 246 | -        if (\str_starts_with($pattern, '[/')) { | 
                                                        |
| 247 | - $pattern = '[' . \substr($pattern, 2);  | 
                                                        |
| 246 | +        if (\str_starts_with($pattern, '[/')){ | 
                                                        |
| 247 | + $pattern = '['.\substr($pattern, 2);  | 
                                                        |
| 248 | 248 | }  | 
                                                        
| 249 | 249 | |
| 250 | -        if (\preg_match_all('/<(\w+):?(.*?)?>/', $pattern, $matches)) { | 
                                                        |
| 250 | +        if (\preg_match_all('/<(\w+):?(.*?)?>/', $pattern, $matches)){ | 
                                                        |
| 251 | 251 | $variables = \array_combine($matches[1], $matches[2]);  | 
                                                        
| 252 | 252 | |
| 253 | -            foreach ($variables as $key => $segment) { | 
                                                        |
| 253 | +            foreach ($variables as $key => $segment){ | 
                                                        |
| 254 | 254 | $segment = $this->prepareSegment($key, $segment);  | 
                                                        
| 255 | 255 |                  $replaces[\sprintf('<%s>', $key)] = \sprintf('(?P<%s>%s)', $key, $segment); | 
                                                        
| 256 | 256 | $options[] = $key;  | 
                                                        
@@ -260,13 +260,13 @@ discard block  | 
                                                    ||
| 260 | 260 |          $template = \preg_replace('/<(\w+):?.*?>/', '<\1>', $pattern); | 
                                                        
| 261 | 261 | $options = \array_fill_keys($options, null);  | 
                                                        
| 262 | 262 | |
| 263 | -        foreach ($this->constrains as $key => $value) { | 
                                                        |
| 264 | -            if ($value instanceof Autofill) { | 
                                                        |
| 263 | +        foreach ($this->constrains as $key => $value){ | 
                                                        |
| 264 | +            if ($value instanceof Autofill){ | 
                                                        |
| 265 | 265 | // only forces value replacement, not required to be presented as parameter  | 
                                                        
| 266 | 266 | continue;  | 
                                                        
| 267 | 267 | }  | 
                                                        
| 268 | 268 | |
| 269 | -            if (!\array_key_exists($key, $options) && !isset($this->defaults[$key])) { | 
                                                        |
| 269 | +            if (!\array_key_exists($key, $options) && !isset($this->defaults[$key])){ | 
                                                        |
| 270 | 270 | throw new ConstrainException(  | 
                                                        
| 271 | 271 | \sprintf(  | 
                                                        
| 272 | 272 | 'Route `%s` does not define routing parameter `<%s>`.',  | 
                                                        
@@ -277,7 +277,7 @@ discard block  | 
                                                    ||
| 277 | 277 | }  | 
                                                        
| 278 | 278 | }  | 
                                                        
| 279 | 279 | |
| 280 | - $this->compiled = '/^' . \strtr($template, $replaces + self::PATTERN_REPLACES) . '$/iu';  | 
                                                        |
| 280 | + $this->compiled = '/^'.\strtr($template, $replaces + self::PATTERN_REPLACES).'$/iu';  | 
                                                        |
| 281 | 281 |          $this->template = \stripslashes(\str_replace('?', '', $template)); | 
                                                        
| 282 | 282 | $this->options = $options;  | 
                                                        
| 283 | 283 | }  | 
                                                        
@@ -288,9 +288,9 @@ discard block  | 
                                                    ||
| 288 | 288 | private function interpolate(string $string, array $values): string  | 
                                                        
| 289 | 289 |      { | 
                                                        
| 290 | 290 | $replaces = [];  | 
                                                        
| 291 | -        foreach ($values as $key => $value) { | 
                                                        |
| 291 | +        foreach ($values as $key => $value){ | 
                                                        |
| 292 | 292 |              $replaces[\sprintf('<%s>', $key)] = match (true) { | 
                                                        
| 293 | - $value instanceof \Stringable || \is_scalar($value) => (string) $value,  | 
                                                        |
| 293 | + $value instanceof \Stringable || \is_scalar($value) => (string)$value,  | 
                                                        |
| 294 | 294 | default => '',  | 
                                                        
| 295 | 295 | };  | 
                                                        
| 296 | 296 | }  | 
                                                        
@@ -90,7 +90,8 @@ discard block  | 
                                                    ||
| 90 | 90 | |
| 91 | 91 | public function withBasePath(string $basePath): self  | 
                                                        
| 92 | 92 |      { | 
                                                        
| 93 | -        if (!\str_ends_with($basePath, '/')) { | 
                                                        |
| 93 | + if (!\str_ends_with($basePath, '/'))  | 
                                                        |
| 94 | +        { | 
                                                        |
| 94 | 95 | $basePath .= '/';  | 
                                                        
| 95 | 96 | }  | 
                                                        
| 96 | 97 | |
@@ -127,12 +128,14 @@ discard block  | 
                                                    ||
| 127 | 128 | */  | 
                                                        
| 128 | 129 | public function match(UriInterface $uri, array $defaults): ?array  | 
                                                        
| 129 | 130 |      { | 
                                                        
| 130 | -        if (!$this->isCompiled()) { | 
                                                        |
| 131 | + if (!$this->isCompiled())  | 
                                                        |
| 132 | +        { | 
                                                        |
| 131 | 133 | $this->compile();  | 
                                                        
| 132 | 134 | }  | 
                                                        
| 133 | 135 | |
| 134 | 136 | $matches = [];  | 
                                                        
| 135 | -        if (!\preg_match($this->compiled, $this->fetchTarget($uri), $matches)) { | 
                                                        |
| 137 | + if (!\preg_match($this->compiled, $this->fetchTarget($uri), $matches))  | 
                                                        |
| 138 | +        { | 
                                                        |
| 136 | 139 | return null;  | 
                                                        
| 137 | 140 | }  | 
                                                        
| 138 | 141 | |
@@ -149,7 +152,8 @@ discard block  | 
                                                    ||
| 149 | 152 | */  | 
                                                        
| 150 | 153 | public function uri(iterable $parameters = [], array $defaults = []): UriInterface  | 
                                                        
| 151 | 154 |      { | 
                                                        
| 152 | -        if (!$this->isCompiled()) { | 
                                                        |
| 155 | + if (!$this->isCompiled())  | 
                                                        |
| 156 | +        { | 
                                                        |
| 153 | 157 | $this->compile();  | 
                                                        
| 154 | 158 | }  | 
                                                        
| 155 | 159 | |
@@ -159,8 +163,10 @@ discard block  | 
                                                    ||
| 159 | 163 | $this->fetchOptions($parameters, $query)  | 
                                                        
| 160 | 164 | );  | 
                                                        
| 161 | 165 | |
| 162 | -        foreach ($this->constrains as $key => $_) { | 
                                                        |
| 163 | -            if (empty($parameters[$key])) { | 
                                                        |
| 166 | + foreach ($this->constrains as $key => $_)  | 
                                                        |
| 167 | +        { | 
                                                        |
| 168 | + if (empty($parameters[$key]))  | 
                                                        |
| 169 | +            { | 
                                                        |
| 164 | 170 |                  throw new UriHandlerException(\sprintf('Unable to generate Uri, parameter `%s` is missing', $key)); | 
                                                        
| 165 | 171 | }  | 
                                                        
| 166 | 172 | }  | 
                                                        
@@ -184,18 +190,23 @@ discard block  | 
                                                    ||
| 184 | 190 | $allowed = \array_keys($this->options);  | 
                                                        
| 185 | 191 | |
| 186 | 192 | $result = [];  | 
                                                        
| 187 | -        foreach ($parameters as $key => $parameter) { | 
                                                        |
| 188 | -            if (\is_int($key) && isset($allowed[$key])) { | 
                                                        |
| 193 | + foreach ($parameters as $key => $parameter)  | 
                                                        |
| 194 | +        { | 
                                                        |
| 195 | + if (\is_int($key) && isset($allowed[$key]))  | 
                                                        |
| 196 | +            { | 
                                                        |
| 189 | 197 | // this segment fetched keys from given parameters either by name or by position  | 
                                                        
| 190 | 198 | $key = $allowed[$key];  | 
                                                        
| 191 | -            } elseif (!\array_key_exists($key, $this->options) && \is_array($parameters)) { | 
                                                        |
| 199 | + }  | 
                                                        |
| 200 | + elseif (!\array_key_exists($key, $this->options) && \is_array($parameters))  | 
                                                        |
| 201 | +            { | 
                                                        |
| 192 | 202 | // all additional parameters given in array form can be glued to query string  | 
                                                        
| 193 | 203 | $query[$key] = $parameter;  | 
                                                        
| 194 | 204 | continue;  | 
                                                        
| 195 | 205 | }  | 
                                                        
| 196 | 206 | |
| 197 | 207 | //String must be normalized here  | 
                                                        
| 198 | -            if (\is_string($parameter) && !\preg_match('/^[a-z\-_0-9]+$/i', $parameter)) { | 
                                                        |
| 208 | +            if (\is_string($parameter) && !\preg_match('/^[a-z\-_0-9]+$/i', $parameter)) | 
                                                        |
| 209 | +            { | 
                                                        |
| 199 | 210 | $result[$key] = $this->slugify->slugify($parameter);  | 
                                                        
| 200 | 211 | continue;  | 
                                                        
| 201 | 212 | }  | 
                                                        
@@ -213,15 +224,20 @@ discard block  | 
                                                    ||
| 213 | 224 |      { | 
                                                        
| 214 | 225 | $path = $uri->getPath();  | 
                                                        
| 215 | 226 | |
| 216 | -        if (empty($path) || $path[0] !== '/') { | 
                                                        |
| 227 | + if (empty($path) || $path[0] !== '/')  | 
                                                        |
| 228 | +        { | 
                                                        |
| 217 | 229 | $path = '/' . $path;  | 
                                                        
| 218 | 230 | }  | 
                                                        
| 219 | 231 | |
| 220 | -        if ($this->matchHost) { | 
                                                        |
| 232 | + if ($this->matchHost)  | 
                                                        |
| 233 | +        { | 
                                                        |
| 221 | 234 | $uriString = $uri->getHost() . $path;  | 
                                                        
| 222 | -        } else { | 
                                                        |
| 235 | + }  | 
                                                        |
| 236 | + else  | 
                                                        |
| 237 | +        { | 
                                                        |
| 223 | 238 | $uriString = \substr($path, \strlen($this->basePath));  | 
                                                        
| 224 | -            if ($uriString === false) { | 
                                                        |
| 239 | + if ($uriString === false)  | 
                                                        |
| 240 | +            { | 
                                                        |
| 225 | 241 | $uriString = '';  | 
                                                        
| 226 | 242 | }  | 
                                                        
| 227 | 243 | }  | 
                                                        
@@ -234,7 +250,8 @@ discard block  | 
                                                    ||
| 234 | 250 | */  | 
                                                        
| 235 | 251 | private function compile(): void  | 
                                                        
| 236 | 252 |      { | 
                                                        
| 237 | -        if ($this->pattern === null) { | 
                                                        |
| 253 | + if ($this->pattern === null)  | 
                                                        |
| 254 | +        { | 
                                                        |
| 238 | 255 |              throw new UriHandlerException('Unable to compile UriHandler, pattern is not set'); | 
                                                        
| 239 | 256 | }  | 
                                                        
| 240 | 257 | |
@@ -243,14 +260,17 @@ discard block  | 
                                                    ||
| 243 | 260 | $pattern = \rtrim(\ltrim($this->getPrefix() . '/' . $this->pattern, ':/'), '/');  | 
                                                        
| 244 | 261 | |
| 245 | 262 | // correct [/ first occurrence]  | 
                                                        
| 246 | -        if (\str_starts_with($pattern, '[/')) { | 
                                                        |
| 263 | + if (\str_starts_with($pattern, '[/'))  | 
                                                        |
| 264 | +        { | 
                                                        |
| 247 | 265 | $pattern = '[' . \substr($pattern, 2);  | 
                                                        
| 248 | 266 | }  | 
                                                        
| 249 | 267 | |
| 250 | -        if (\preg_match_all('/<(\w+):?(.*?)?>/', $pattern, $matches)) { | 
                                                        |
| 268 | +        if (\preg_match_all('/<(\w+):?(.*?)?>/', $pattern, $matches)) | 
                                                        |
| 269 | +        { | 
                                                        |
| 251 | 270 | $variables = \array_combine($matches[1], $matches[2]);  | 
                                                        
| 252 | 271 | |
| 253 | -            foreach ($variables as $key => $segment) { | 
                                                        |
| 272 | + foreach ($variables as $key => $segment)  | 
                                                        |
| 273 | +            { | 
                                                        |
| 254 | 274 | $segment = $this->prepareSegment($key, $segment);  | 
                                                        
| 255 | 275 |                  $replaces[\sprintf('<%s>', $key)] = \sprintf('(?P<%s>%s)', $key, $segment); | 
                                                        
| 256 | 276 | $options[] = $key;  | 
                                                        
@@ -260,13 +280,16 @@ discard block  | 
                                                    ||
| 260 | 280 |          $template = \preg_replace('/<(\w+):?.*?>/', '<\1>', $pattern); | 
                                                        
| 261 | 281 | $options = \array_fill_keys($options, null);  | 
                                                        
| 262 | 282 | |
| 263 | -        foreach ($this->constrains as $key => $value) { | 
                                                        |
| 264 | -            if ($value instanceof Autofill) { | 
                                                        |
| 283 | + foreach ($this->constrains as $key => $value)  | 
                                                        |
| 284 | +        { | 
                                                        |
| 285 | + if ($value instanceof Autofill)  | 
                                                        |
| 286 | +            { | 
                                                        |
| 265 | 287 | // only forces value replacement, not required to be presented as parameter  | 
                                                        
| 266 | 288 | continue;  | 
                                                        
| 267 | 289 | }  | 
                                                        
| 268 | 290 | |
| 269 | -            if (!\array_key_exists($key, $options) && !isset($this->defaults[$key])) { | 
                                                        |
| 291 | + if (!\array_key_exists($key, $options) && !isset($this->defaults[$key]))  | 
                                                        |
| 292 | +            { | 
                                                        |
| 270 | 293 | throw new ConstrainException(  | 
                                                        
| 271 | 294 | \sprintf(  | 
                                                        
| 272 | 295 | 'Route `%s` does not define routing parameter `<%s>`.',  | 
                                                        
@@ -288,7 +311,8 @@ discard block  | 
                                                    ||
| 288 | 311 | private function interpolate(string $string, array $values): string  | 
                                                        
| 289 | 312 |      { | 
                                                        
| 290 | 313 | $replaces = [];  | 
                                                        
| 291 | -        foreach ($values as $key => $value) { | 
                                                        |
| 314 | + foreach ($values as $key => $value)  | 
                                                        |
| 315 | +        { | 
                                                        |
| 292 | 316 |              $replaces[\sprintf('<%s>', $key)] = match (true) { | 
                                                        
| 293 | 317 | $value instanceof \Stringable || \is_scalar($value) => (string) $value,  | 
                                                        
| 294 | 318 | default => '',  | 
                                                        
@@ -49,8 +49,8 @@ discard block  | 
                                                    ||
| 49 | 49 | private readonly ContainerInterface $container,  | 
                                                        
| 50 | 50 | private readonly ?EventDispatcherInterface $eventDispatcher = null,  | 
                                                        
| 51 | 51 | private readonly ?TracerInterface $tracer = new NullTracer(),  | 
                                                        
| 52 | -    ) { | 
                                                        |
| 53 | - $this->basePath = '/' . \ltrim($basePath, '/');  | 
                                                        |
| 52 | +    ){ | 
                                                        |
| 53 | + $this->basePath = '/'.\ltrim($basePath, '/');  | 
                                                        |
| 54 | 54 | }  | 
                                                        
| 55 | 55 | |
| 56 | 56 | /**  | 
                                                        
@@ -64,13 +64,13 @@ discard block  | 
                                                    ||
| 64 | 64 | return $this->tracer->trace(  | 
                                                        
| 65 | 65 | name: 'Routing',  | 
                                                        
| 66 | 66 |              callback: function (SpanInterface $span) use ($request) { | 
                                                        
| 67 | -                try { | 
                                                        |
| 67 | +                try{ | 
                                                        |
| 68 | 68 | $route = $this->matchRoute($request, $routeName);  | 
                                                        
| 69 | -                } catch (RouteException $e) { | 
                                                        |
| 69 | +                }catch (RouteException $e){ | 
                                                        |
| 70 | 70 |                      throw new RouterException('Invalid route definition', $e->getCode(), $e); | 
                                                        
| 71 | 71 | }  | 
                                                        
| 72 | 72 | |
| 73 | -                if ($route === null) { | 
                                                        |
| 73 | +                if ($route === null){ | 
                                                        |
| 74 | 74 | $this->eventDispatcher?->dispatch(new RouteNotFound($request));  | 
                                                        
| 75 | 75 | throw new RouteNotFoundException($request->getUri());  | 
                                                        
| 76 | 76 | }  | 
                                                        
@@ -105,7 +105,7 @@ discard block  | 
                                                    ||
| 105 | 105 | |
| 106 | 106 | public function getRoute(string $name): RouteInterface  | 
                                                        
| 107 | 107 |      { | 
                                                        
| 108 | -        if (isset($this->routes[$name])) { | 
                                                        |
| 108 | +        if (isset($this->routes[$name])){ | 
                                                        |
| 109 | 109 | return $this->routes[$name];  | 
                                                        
| 110 | 110 | }  | 
                                                        
| 111 | 111 | |
@@ -114,7 +114,7 @@ discard block  | 
                                                    ||
| 114 | 114 | |
| 115 | 115 | public function getRoutes(): array  | 
                                                        
| 116 | 116 |      { | 
                                                        
| 117 | -        if (!empty($this->default)) { | 
                                                        |
| 117 | +        if (!empty($this->default)){ | 
                                                        |
| 118 | 118 | return $this->routes + [null => $this->default];  | 
                                                        
| 119 | 119 | }  | 
                                                        
| 120 | 120 | |
@@ -123,9 +123,9 @@ discard block  | 
                                                    ||
| 123 | 123 | |
| 124 | 124 | public function uri(string $route, iterable $parameters = []): UriInterface  | 
                                                        
| 125 | 125 |      { | 
                                                        
| 126 | -        try { | 
                                                        |
| 126 | +        try{ | 
                                                        |
| 127 | 127 | return $this->getRoute($route)->uri($parameters);  | 
                                                        
| 128 | -        } catch (UndefinedRouteException) { | 
                                                        |
| 128 | +        }catch (UndefinedRouteException){ | 
                                                        |
| 129 | 129 | //In some cases route name can be provided as controller:action pair, we can try to  | 
                                                        
| 130 | 130 | //generate such route automatically based on our default/fallback route  | 
                                                        
| 131 | 131 | return $this->castRoute($route)->uri($parameters);  | 
                                                        
@@ -137,29 +137,29 @@ discard block  | 
                                                    ||
| 137 | 137 | /** @var GroupRegistry $groups */  | 
                                                        
| 138 | 138 | $groups = $this->container->get(GroupRegistry::class);  | 
                                                        
| 139 | 139 | |
| 140 | -        foreach ($routes->getCollection() as $name => $configurator) { | 
                                                        |
| 140 | +        foreach ($routes->getCollection() as $name => $configurator){ | 
                                                        |
| 141 | 141 | $target = $configurator->target;  | 
                                                        
| 142 | -            if ($configurator->core !== null && $target instanceof AbstractTarget) { | 
                                                        |
| 142 | +            if ($configurator->core !== null && $target instanceof AbstractTarget){ | 
                                                        |
| 143 | 143 | $target = $target->withCore($configurator->core);  | 
                                                        
| 144 | 144 | }  | 
                                                        
| 145 | 145 | |
| 146 | 146 | $route = new Route(\ltrim($configurator->pattern, '/'), $target, $configurator->defaults);  | 
                                                        
| 147 | 147 | |
| 148 | -            if ($configurator->middleware !== null) { | 
                                                        |
| 148 | +            if ($configurator->middleware !== null){ | 
                                                        |
| 149 | 149 | $route = $route->withMiddleware(...$configurator->middleware);  | 
                                                        
| 150 | 150 | }  | 
                                                        
| 151 | 151 | |
| 152 | -            if ($configurator->methods !== null) { | 
                                                        |
| 152 | +            if ($configurator->methods !== null){ | 
                                                        |
| 153 | 153 | $route = $route->withVerbs(...$configurator->methods);  | 
                                                        
| 154 | 154 | }  | 
                                                        
| 155 | 155 | |
| 156 | -            if (!isset($this->routes[$name]) && $name !== RoutingConfigurator::DEFAULT_ROUTE_NAME) { | 
                                                        |
| 156 | +            if (!isset($this->routes[$name]) && $name !== RoutingConfigurator::DEFAULT_ROUTE_NAME){ | 
                                                        |
| 157 | 157 | $group = $groups->getGroup($configurator->group ?? $groups->getDefaultGroup());  | 
                                                        
| 158 | 158 | $group->setPrefix($configurator->prefix);  | 
                                                        
| 159 | 159 | $group->addRoute($name, $route);  | 
                                                        
| 160 | 160 | }  | 
                                                        
| 161 | 161 | |
| 162 | -            if ($name === RoutingConfigurator::DEFAULT_ROUTE_NAME) { | 
                                                        |
| 162 | +            if ($name === RoutingConfigurator::DEFAULT_ROUTE_NAME){ | 
                                                        |
| 163 | 163 | $this->setDefault($route);  | 
                                                        
| 164 | 164 | }  | 
                                                        
| 165 | 165 | }  | 
                                                        
@@ -170,17 +170,17 @@ discard block  | 
                                                    ||
| 170 | 170 | */  | 
                                                        
| 171 | 171 | protected function matchRoute(ServerRequestInterface $request, string &$routeName = null): ?RouteInterface  | 
                                                        
| 172 | 172 |      { | 
                                                        
| 173 | -        foreach ($this->routes as $name => $route) { | 
                                                        |
| 173 | +        foreach ($this->routes as $name => $route){ | 
                                                        |
| 174 | 174 | // Matched route will return new route instance with matched parameters  | 
                                                        
| 175 | 175 | $matched = $route->match($request);  | 
                                                        
| 176 | 176 | |
| 177 | -            if ($matched !== null) { | 
                                                        |
| 177 | +            if ($matched !== null){ | 
                                                        |
| 178 | 178 | $routeName = $name;  | 
                                                        
| 179 | 179 | return $matched;  | 
                                                        
| 180 | 180 | }  | 
                                                        
| 181 | 181 | }  | 
                                                        
| 182 | 182 | |
| 183 | -        if ($this->default !== null) { | 
                                                        |
| 183 | +        if ($this->default !== null){ | 
                                                        |
| 184 | 184 | return $this->default->match($request);  | 
                                                        
| 185 | 185 | }  | 
                                                        
| 186 | 186 | |
@@ -193,14 +193,14 @@ discard block  | 
                                                    ||
| 193 | 193 | */  | 
                                                        
| 194 | 194 | protected function configure(RouteInterface $route): RouteInterface  | 
                                                        
| 195 | 195 |      { | 
                                                        
| 196 | -        if ($route instanceof ContainerizedInterface && !$route->hasContainer()) { | 
                                                        |
| 196 | +        if ($route instanceof ContainerizedInterface && !$route->hasContainer()){ | 
                                                        |
| 197 | 197 | // isolating route in a given container  | 
                                                        
| 198 | 198 | $route = $route->withContainer($this->container);  | 
                                                        
| 199 | 199 | }  | 
                                                        
| 200 | 200 | |
| 201 | -        try { | 
                                                        |
| 201 | +        try{ | 
                                                        |
| 202 | 202 | $uriHandler = $route->getUriHandler();  | 
                                                        
| 203 | -        } catch (\Throwable) { | 
                                                        |
| 203 | +        }catch (\Throwable){ | 
                                                        |
| 204 | 204 | $uriHandler = $this->uriHandler;  | 
                                                        
| 205 | 205 | }  | 
                                                        
| 206 | 206 | |
@@ -223,17 +223,17 @@ discard block  | 
                                                    ||
| 223 | 223 | $route,  | 
                                                        
| 224 | 224 | $matches  | 
                                                        
| 225 | 225 | )  | 
                                                        
| 226 | -        ) { | 
                                                        |
| 226 | +        ){ | 
                                                        |
| 227 | 227 | throw new UndefinedRouteException(  | 
                                                        
| 228 | 228 | "Unable to locate route or use default route with 'name/controller:action' pattern"  | 
                                                        
| 229 | 229 | );  | 
                                                        
| 230 | 230 | }  | 
                                                        
| 231 | 231 | |
| 232 | -        if (!empty($matches['name'])) { | 
                                                        |
| 232 | +        if (!empty($matches['name'])){ | 
                                                        |
| 233 | 233 | $routeObject = $this->getRoute($matches['name']);  | 
                                                        
| 234 | -        } elseif ($this->default !== null) { | 
                                                        |
| 234 | +        } elseif ($this->default !== null){ | 
                                                        |
| 235 | 235 | $routeObject = $this->default;  | 
                                                        
| 236 | -        } else { | 
                                                        |
| 236 | +        }else{ | 
                                                        |
| 237 | 237 |              throw new UndefinedRouteException(\sprintf('Unable to locate route candidate for `%s`', $route)); | 
                                                        
| 238 | 238 | }  | 
                                                        
| 239 | 239 | |
@@ -63,14 +63,19 @@ discard block  | 
                                                    ||
| 63 | 63 | |
| 64 | 64 | return $this->tracer->trace(  | 
                                                        
| 65 | 65 | name: 'Routing',  | 
                                                        
| 66 | -            callback: function (SpanInterface $span) use ($request) { | 
                                                        |
| 67 | -                try { | 
                                                        |
| 66 | + callback: function (SpanInterface $span) use ($request)  | 
                                                        |
| 67 | +            { | 
                                                        |
| 68 | + try  | 
                                                        |
| 69 | +                { | 
                                                        |
| 68 | 70 | $route = $this->matchRoute($request, $routeName);  | 
                                                        
| 69 | -                } catch (RouteException $e) { | 
                                                        |
| 71 | + }  | 
                                                        |
| 72 | + catch (RouteException $e)  | 
                                                        |
| 73 | +                { | 
                                                        |
| 70 | 74 |                      throw new RouterException('Invalid route definition', $e->getCode(), $e); | 
                                                        
| 71 | 75 | }  | 
                                                        
| 72 | 76 | |
| 73 | -                if ($route === null) { | 
                                                        |
| 77 | + if ($route === null)  | 
                                                        |
| 78 | +                { | 
                                                        |
| 74 | 79 | $this->eventDispatcher?->dispatch(new RouteNotFound($request));  | 
                                                        
| 75 | 80 | throw new RouteNotFoundException($request->getUri());  | 
                                                        
| 76 | 81 | }  | 
                                                        
@@ -105,7 +110,8 @@ discard block  | 
                                                    ||
| 105 | 110 | |
| 106 | 111 | public function getRoute(string $name): RouteInterface  | 
                                                        
| 107 | 112 |      { | 
                                                        
| 108 | -        if (isset($this->routes[$name])) { | 
                                                        |
| 113 | + if (isset($this->routes[$name]))  | 
                                                        |
| 114 | +        { | 
                                                        |
| 109 | 115 | return $this->routes[$name];  | 
                                                        
| 110 | 116 | }  | 
                                                        
| 111 | 117 | |
@@ -114,7 +120,8 @@ discard block  | 
                                                    ||
| 114 | 120 | |
| 115 | 121 | public function getRoutes(): array  | 
                                                        
| 116 | 122 |      { | 
                                                        
| 117 | -        if (!empty($this->default)) { | 
                                                        |
| 123 | + if (!empty($this->default))  | 
                                                        |
| 124 | +        { | 
                                                        |
| 118 | 125 | return $this->routes + [null => $this->default];  | 
                                                        
| 119 | 126 | }  | 
                                                        
| 120 | 127 | |
@@ -123,9 +130,12 @@ discard block  | 
                                                    ||
| 123 | 130 | |
| 124 | 131 | public function uri(string $route, iterable $parameters = []): UriInterface  | 
                                                        
| 125 | 132 |      { | 
                                                        
| 126 | -        try { | 
                                                        |
| 133 | + try  | 
                                                        |
| 134 | +        { | 
                                                        |
| 127 | 135 | return $this->getRoute($route)->uri($parameters);  | 
                                                        
| 128 | -        } catch (UndefinedRouteException) { | 
                                                        |
| 136 | + }  | 
                                                        |
| 137 | + catch (UndefinedRouteException)  | 
                                                        |
| 138 | +        { | 
                                                        |
| 129 | 139 | //In some cases route name can be provided as controller:action pair, we can try to  | 
                                                        
| 130 | 140 | //generate such route automatically based on our default/fallback route  | 
                                                        
| 131 | 141 | return $this->castRoute($route)->uri($parameters);  | 
                                                        
@@ -137,29 +147,35 @@ discard block  | 
                                                    ||
| 137 | 147 | /** @var GroupRegistry $groups */  | 
                                                        
| 138 | 148 | $groups = $this->container->get(GroupRegistry::class);  | 
                                                        
| 139 | 149 | |
| 140 | -        foreach ($routes->getCollection() as $name => $configurator) { | 
                                                        |
| 150 | + foreach ($routes->getCollection() as $name => $configurator)  | 
                                                        |
| 151 | +        { | 
                                                        |
| 141 | 152 | $target = $configurator->target;  | 
                                                        
| 142 | -            if ($configurator->core !== null && $target instanceof AbstractTarget) { | 
                                                        |
| 153 | + if ($configurator->core !== null && $target instanceof AbstractTarget)  | 
                                                        |
| 154 | +            { | 
                                                        |
| 143 | 155 | $target = $target->withCore($configurator->core);  | 
                                                        
| 144 | 156 | }  | 
                                                        
| 145 | 157 | |
| 146 | 158 | $route = new Route(\ltrim($configurator->pattern, '/'), $target, $configurator->defaults);  | 
                                                        
| 147 | 159 | |
| 148 | -            if ($configurator->middleware !== null) { | 
                                                        |
| 160 | + if ($configurator->middleware !== null)  | 
                                                        |
| 161 | +            { | 
                                                        |
| 149 | 162 | $route = $route->withMiddleware(...$configurator->middleware);  | 
                                                        
| 150 | 163 | }  | 
                                                        
| 151 | 164 | |
| 152 | -            if ($configurator->methods !== null) { | 
                                                        |
| 165 | + if ($configurator->methods !== null)  | 
                                                        |
| 166 | +            { | 
                                                        |
| 153 | 167 | $route = $route->withVerbs(...$configurator->methods);  | 
                                                        
| 154 | 168 | }  | 
                                                        
| 155 | 169 | |
| 156 | -            if (!isset($this->routes[$name]) && $name !== RoutingConfigurator::DEFAULT_ROUTE_NAME) { | 
                                                        |
| 170 | + if (!isset($this->routes[$name]) && $name !== RoutingConfigurator::DEFAULT_ROUTE_NAME)  | 
                                                        |
| 171 | +            { | 
                                                        |
| 157 | 172 | $group = $groups->getGroup($configurator->group ?? $groups->getDefaultGroup());  | 
                                                        
| 158 | 173 | $group->setPrefix($configurator->prefix);  | 
                                                        
| 159 | 174 | $group->addRoute($name, $route);  | 
                                                        
| 160 | 175 | }  | 
                                                        
| 161 | 176 | |
| 162 | -            if ($name === RoutingConfigurator::DEFAULT_ROUTE_NAME) { | 
                                                        |
| 177 | + if ($name === RoutingConfigurator::DEFAULT_ROUTE_NAME)  | 
                                                        |
| 178 | +            { | 
                                                        |
| 163 | 179 | $this->setDefault($route);  | 
                                                        
| 164 | 180 | }  | 
                                                        
| 165 | 181 | }  | 
                                                        
@@ -170,17 +186,20 @@ discard block  | 
                                                    ||
| 170 | 186 | */  | 
                                                        
| 171 | 187 | protected function matchRoute(ServerRequestInterface $request, string &$routeName = null): ?RouteInterface  | 
                                                        
| 172 | 188 |      { | 
                                                        
| 173 | -        foreach ($this->routes as $name => $route) { | 
                                                        |
| 189 | + foreach ($this->routes as $name => $route)  | 
                                                        |
| 190 | +        { | 
                                                        |
| 174 | 191 | // Matched route will return new route instance with matched parameters  | 
                                                        
| 175 | 192 | $matched = $route->match($request);  | 
                                                        
| 176 | 193 | |
| 177 | -            if ($matched !== null) { | 
                                                        |
| 194 | + if ($matched !== null)  | 
                                                        |
| 195 | +            { | 
                                                        |
| 178 | 196 | $routeName = $name;  | 
                                                        
| 179 | 197 | return $matched;  | 
                                                        
| 180 | 198 | }  | 
                                                        
| 181 | 199 | }  | 
                                                        
| 182 | 200 | |
| 183 | -        if ($this->default !== null) { | 
                                                        |
| 201 | + if ($this->default !== null)  | 
                                                        |
| 202 | +        { | 
                                                        |
| 184 | 203 | return $this->default->match($request);  | 
                                                        
| 185 | 204 | }  | 
                                                        
| 186 | 205 | |
@@ -193,14 +212,18 @@ discard block  | 
                                                    ||
| 193 | 212 | */  | 
                                                        
| 194 | 213 | protected function configure(RouteInterface $route): RouteInterface  | 
                                                        
| 195 | 214 |      { | 
                                                        
| 196 | -        if ($route instanceof ContainerizedInterface && !$route->hasContainer()) { | 
                                                        |
| 215 | + if ($route instanceof ContainerizedInterface && !$route->hasContainer())  | 
                                                        |
| 216 | +        { | 
                                                        |
| 197 | 217 | // isolating route in a given container  | 
                                                        
| 198 | 218 | $route = $route->withContainer($this->container);  | 
                                                        
| 199 | 219 | }  | 
                                                        
| 200 | 220 | |
| 201 | -        try { | 
                                                        |
| 221 | + try  | 
                                                        |
| 222 | +        { | 
                                                        |
| 202 | 223 | $uriHandler = $route->getUriHandler();  | 
                                                        
| 203 | -        } catch (\Throwable) { | 
                                                        |
| 224 | + }  | 
                                                        |
| 225 | + catch (\Throwable)  | 
                                                        |
| 226 | +        { | 
                                                        |
| 204 | 227 | $uriHandler = $this->uriHandler;  | 
                                                        
| 205 | 228 | }  | 
                                                        
| 206 | 229 | |
@@ -229,11 +252,16 @@ discard block  | 
                                                    ||
| 229 | 252 | );  | 
                                                        
| 230 | 253 | }  | 
                                                        
| 231 | 254 | |
| 232 | -        if (!empty($matches['name'])) { | 
                                                        |
| 255 | + if (!empty($matches['name']))  | 
                                                        |
| 256 | +        { | 
                                                        |
| 233 | 257 | $routeObject = $this->getRoute($matches['name']);  | 
                                                        
| 234 | -        } elseif ($this->default !== null) { | 
                                                        |
| 258 | + }  | 
                                                        |
| 259 | + elseif ($this->default !== null)  | 
                                                        |
| 260 | +        { | 
                                                        |
| 235 | 261 | $routeObject = $this->default;  | 
                                                        
| 236 | -        } else { | 
                                                        |
| 262 | + }  | 
                                                        |
| 263 | + else  | 
                                                        |
| 264 | +        { | 
                                                        |
| 237 | 265 |              throw new UndefinedRouteException(\sprintf('Unable to locate route candidate for `%s`', $route)); | 
                                                        
| 238 | 266 | }  | 
                                                        
| 239 | 267 | |
@@ -13,7 +13,7 @@ discard block  | 
                                                    ||
| 13 | 13 | public function __construct(  | 
                                                        
| 14 | 14 | private readonly RouteCollection $parent,  | 
                                                        
| 15 | 15 | private readonly RouteCollection $routes  | 
                                                        
| 16 | -    ) { | 
                                                        |
| 16 | +    ){ | 
                                                        |
| 17 | 17 | }  | 
                                                        
| 18 | 18 | |
| 19 | 19 | public function __destruct()  | 
                                                        
@@ -23,17 +23,17 @@ discard block  | 
                                                    ||
| 23 | 23 | |
| 24 | 24 | public function __sleep(): array  | 
                                                        
| 25 | 25 |      { | 
                                                        
| 26 | -        throw new \BadMethodCallException('Cannot unserialize ' . self::class); | 
                                                        |
| 26 | +        throw new \BadMethodCallException('Cannot unserialize '.self::class); | 
                                                        |
| 27 | 27 | }  | 
                                                        
| 28 | 28 | |
| 29 | 29 | public function __wakeup()  | 
                                                        
| 30 | 30 |      { | 
                                                        
| 31 | -        throw new \BadMethodCallException('Cannot unserialize ' . self::class); | 
                                                        |
| 31 | +        throw new \BadMethodCallException('Cannot unserialize '.self::class); | 
                                                        |
| 32 | 32 | }  | 
                                                        
| 33 | 33 | |
| 34 | 34 | public function defaults(array $defaults): self  | 
                                                        
| 35 | 35 |      { | 
                                                        
| 36 | -        foreach ($this->routes->all() as $configurator) { | 
                                                        |
| 36 | +        foreach ($this->routes->all() as $configurator){ | 
                                                        |
| 37 | 37 | $configurator->defaults($defaults);  | 
                                                        
| 38 | 38 | }  | 
                                                        
| 39 | 39 | |
@@ -45,7 +45,7 @@ discard block  | 
                                                    ||
| 45 | 45 | */  | 
                                                        
| 46 | 46 | public function group(string $group): self  | 
                                                        
| 47 | 47 |      { | 
                                                        
| 48 | -        foreach ($this->routes->all() as $configurator) { | 
                                                        |
| 48 | +        foreach ($this->routes->all() as $configurator){ | 
                                                        |
| 49 | 49 | $configurator->group($group);  | 
                                                        
| 50 | 50 | }  | 
                                                        
| 51 | 51 | |
@@ -57,7 +57,7 @@ discard block  | 
                                                    ||
| 57 | 57 | */  | 
                                                        
| 58 | 58 | public function prefix(string $prefix): self  | 
                                                        
| 59 | 59 |      { | 
                                                        
| 60 | -        foreach ($this->routes->all() as $configurator) { | 
                                                        |
| 60 | +        foreach ($this->routes->all() as $configurator){ | 
                                                        |
| 61 | 61 | $configurator->prefix($prefix);  | 
                                                        
| 62 | 62 | }  | 
                                                        
| 63 | 63 | |
@@ -69,8 +69,8 @@ discard block  | 
                                                    ||
| 69 | 69 | */  | 
                                                        
| 70 | 70 | public function namePrefix(string $prefix): self  | 
                                                        
| 71 | 71 |      { | 
                                                        
| 72 | -        foreach ($this->routes->all() as $name => $configurator) { | 
                                                        |
| 73 | - $this->routes->add($prefix . $name, $configurator);  | 
                                                        |
| 72 | +        foreach ($this->routes->all() as $name => $configurator){ | 
                                                        |
| 73 | + $this->routes->add($prefix.$name, $configurator);  | 
                                                        |
| 74 | 74 | $this->routes->remove($name);  | 
                                                        
| 75 | 75 | }  | 
                                                        
| 76 | 76 | |
@@ -79,16 +79,16 @@ discard block  | 
                                                    ||
| 79 | 79 | |
| 80 | 80 | public function core(CoreInterface $core): self  | 
                                                        
| 81 | 81 |      { | 
                                                        
| 82 | -        foreach ($this->routes->all() as $configurator) { | 
                                                        |
| 82 | +        foreach ($this->routes->all() as $configurator){ | 
                                                        |
| 83 | 83 | $configurator->core($core);  | 
                                                        
| 84 | 84 | }  | 
                                                        
| 85 | 85 | |
| 86 | 86 | return $this;  | 
                                                        
| 87 | 87 | }  | 
                                                        
| 88 | 88 | |
| 89 | - public function middleware(MiddlewareInterface|string|array $middleware): self  | 
                                                        |
| 89 | + public function middleware(MiddlewareInterface | string | array $middleware): self  | 
                                                        |
| 90 | 90 |      { | 
                                                        
| 91 | -        foreach ($this->routes->all() as $configurator) { | 
                                                        |
| 91 | +        foreach ($this->routes->all() as $configurator){ | 
                                                        |
| 92 | 92 | $configurator->middleware($middleware);  | 
                                                        
| 93 | 93 | }  | 
                                                        
| 94 | 94 | |
@@ -33,7 +33,8 @@ discard block  | 
                                                    ||
| 33 | 33 | |
| 34 | 34 | public function defaults(array $defaults): self  | 
                                                        
| 35 | 35 |      { | 
                                                        
| 36 | -        foreach ($this->routes->all() as $configurator) { | 
                                                        |
| 36 | + foreach ($this->routes->all() as $configurator)  | 
                                                        |
| 37 | +        { | 
                                                        |
| 37 | 38 | $configurator->defaults($defaults);  | 
                                                        
| 38 | 39 | }  | 
                                                        
| 39 | 40 | |
@@ -45,7 +46,8 @@ discard block  | 
                                                    ||
| 45 | 46 | */  | 
                                                        
| 46 | 47 | public function group(string $group): self  | 
                                                        
| 47 | 48 |      { | 
                                                        
| 48 | -        foreach ($this->routes->all() as $configurator) { | 
                                                        |
| 49 | + foreach ($this->routes->all() as $configurator)  | 
                                                        |
| 50 | +        { | 
                                                        |
| 49 | 51 | $configurator->group($group);  | 
                                                        
| 50 | 52 | }  | 
                                                        
| 51 | 53 | |
@@ -57,7 +59,8 @@ discard block  | 
                                                    ||
| 57 | 59 | */  | 
                                                        
| 58 | 60 | public function prefix(string $prefix): self  | 
                                                        
| 59 | 61 |      { | 
                                                        
| 60 | -        foreach ($this->routes->all() as $configurator) { | 
                                                        |
| 62 | + foreach ($this->routes->all() as $configurator)  | 
                                                        |
| 63 | +        { | 
                                                        |
| 61 | 64 | $configurator->prefix($prefix);  | 
                                                        
| 62 | 65 | }  | 
                                                        
| 63 | 66 | |
@@ -69,7 +72,8 @@ discard block  | 
                                                    ||
| 69 | 72 | */  | 
                                                        
| 70 | 73 | public function namePrefix(string $prefix): self  | 
                                                        
| 71 | 74 |      { | 
                                                        
| 72 | -        foreach ($this->routes->all() as $name => $configurator) { | 
                                                        |
| 75 | + foreach ($this->routes->all() as $name => $configurator)  | 
                                                        |
| 76 | +        { | 
                                                        |
| 73 | 77 | $this->routes->add($prefix . $name, $configurator);  | 
                                                        
| 74 | 78 | $this->routes->remove($name);  | 
                                                        
| 75 | 79 | }  | 
                                                        
@@ -79,7 +83,8 @@ discard block  | 
                                                    ||
| 79 | 83 | |
| 80 | 84 | public function core(CoreInterface $core): self  | 
                                                        
| 81 | 85 |      { | 
                                                        
| 82 | -        foreach ($this->routes->all() as $configurator) { | 
                                                        |
| 86 | + foreach ($this->routes->all() as $configurator)  | 
                                                        |
| 87 | +        { | 
                                                        |
| 83 | 88 | $configurator->core($core);  | 
                                                        
| 84 | 89 | }  | 
                                                        
| 85 | 90 | |
@@ -88,7 +93,8 @@ discard block  | 
                                                    ||
| 88 | 93 | |
| 89 | 94 | public function middleware(MiddlewareInterface|string|array $middleware): self  | 
                                                        
| 90 | 95 |      { | 
                                                        
| 91 | -        foreach ($this->routes->all() as $configurator) { | 
                                                        |
| 96 | + foreach ($this->routes->all() as $configurator)  | 
                                                        |
| 97 | +        { | 
                                                        |
| 92 | 98 | $configurator->middleware($middleware);  | 
                                                        
| 93 | 99 | }  | 
                                                        
| 94 | 100 | |
@@ -41,11 +41,11 @@  | 
                                                    ||
| 41 | 41 | public function __construct(  | 
                                                        
| 42 | 42 | public readonly string $route,  | 
                                                        
| 43 | 43 | public readonly ?string $name = null,  | 
                                                        
| 44 | - public readonly array|string $methods = \Spiral\Router\Route::VERBS,  | 
                                                        |
| 44 | + public readonly array | string $methods = \Spiral\Router\Route::VERBS,  | 
                                                        |
| 45 | 45 | public readonly array $defaults = [],  | 
                                                        
| 46 | 46 | public readonly ?string $group = null,  | 
                                                        
| 47 | 47 | public readonly array $middleware = [],  | 
                                                        
| 48 | 48 | public readonly int $priority = 0  | 
                                                        
| 49 | -    ) { | 
                                                        |
| 49 | +    ){ | 
                                                        |
| 50 | 50 | }  | 
                                                        
| 51 | 51 | }  | 
                                                        
@@ -19,15 +19,15 @@ discard block  | 
                                                    ||
| 19 | 19 | public function __construct(  | 
                                                        
| 20 | 20 | private readonly ReaderInterface $reader,  | 
                                                        
| 21 | 21 | private readonly GroupRegistry $groups  | 
                                                        
| 22 | -    ) { | 
                                                        |
| 22 | +    ){ | 
                                                        |
| 23 | 23 | }  | 
                                                        
| 24 | 24 | |
| 25 | 25 | public function listen(ReflectionClass $class): void  | 
                                                        
| 26 | 26 |      { | 
                                                        
| 27 | -        foreach ($class->getMethods() as $method) { | 
                                                        |
| 27 | +        foreach ($class->getMethods() as $method){ | 
                                                        |
| 28 | 28 | $route = $this->reader->firstFunctionMetadata($method, Route::class);  | 
                                                        
| 29 | 29 | |
| 30 | -            if ($route === null) { | 
                                                        |
| 30 | +            if ($route === null){ | 
                                                        |
| 31 | 31 | continue;  | 
                                                        
| 32 | 32 | }  | 
                                                        
| 33 | 33 | |
@@ -40,7 +40,7 @@ discard block  | 
                                                    ||
| 40 | 40 | $defaultGroup = $this->groups->getDefaultGroup();  | 
                                                        
| 41 | 41 | |
| 42 | 42 | $routes = [];  | 
                                                        
| 43 | -        foreach ($this->attributes as $classes) { | 
                                                        |
| 43 | +        foreach ($this->attributes as $classes){ | 
                                                        |
| 44 | 44 | [$method, $route] = $classes;  | 
                                                        
| 45 | 45 | $class = $method->getDeclaringClass();  | 
                                                        
| 46 | 46 | |
@@ -64,7 +64,7 @@ discard block  | 
                                                    ||
| 64 | 64 | |
| 65 | 65 | private function configureRoutes(array $routes): void  | 
                                                        
| 66 | 66 |      { | 
                                                        
| 67 | -        foreach ($routes as $name => $schema) { | 
                                                        |
| 67 | +        foreach ($routes as $name => $schema){ | 
                                                        |
| 68 | 68 | $route = new \Spiral\Router\Route(  | 
                                                        
| 69 | 69 | $schema['pattern'],  | 
                                                        
| 70 | 70 | new Action($schema['controller'], $schema['action']),  | 
                                                        
@@ -24,10 +24,12 @@ discard block  | 
                                                    ||
| 24 | 24 | |
| 25 | 25 | public function listen(ReflectionClass $class): void  | 
                                                        
| 26 | 26 |      { | 
                                                        
| 27 | -        foreach ($class->getMethods() as $method) { | 
                                                        |
| 27 | + foreach ($class->getMethods() as $method)  | 
                                                        |
| 28 | +        { | 
                                                        |
| 28 | 29 | $route = $this->reader->firstFunctionMetadata($method, Route::class);  | 
                                                        
| 29 | 30 | |
| 30 | -            if ($route === null) { | 
                                                        |
| 31 | + if ($route === null)  | 
                                                        |
| 32 | +            { | 
                                                        |
| 31 | 33 | continue;  | 
                                                        
| 32 | 34 | }  | 
                                                        
| 33 | 35 | |
@@ -40,7 +42,8 @@ discard block  | 
                                                    ||
| 40 | 42 | $defaultGroup = $this->groups->getDefaultGroup();  | 
                                                        
| 41 | 43 | |
| 42 | 44 | $routes = [];  | 
                                                        
| 43 | -        foreach ($this->attributes as $classes) { | 
                                                        |
| 45 | + foreach ($this->attributes as $classes)  | 
                                                        |
| 46 | +        { | 
                                                        |
| 44 | 47 | [$method, $route] = $classes;  | 
                                                        
| 45 | 48 | $class = $method->getDeclaringClass();  | 
                                                        
| 46 | 49 | |
@@ -64,7 +67,8 @@ discard block  | 
                                                    ||
| 64 | 67 | |
| 65 | 68 | private function configureRoutes(array $routes): void  | 
                                                        
| 66 | 69 |      { | 
                                                        
| 67 | -        foreach ($routes as $name => $schema) { | 
                                                        |
| 70 | + foreach ($routes as $name => $schema)  | 
                                                        |
| 71 | +        { | 
                                                        |
| 68 | 72 | $route = new \Spiral\Router\Route(  | 
                                                        
| 69 | 73 | $schema['pattern'],  | 
                                                        
| 70 | 74 | new Action($schema['controller'], $schema['action']),  | 
                                                        
@@ -53,7 +53,7 @@  | 
                                                    ||
| 53 | 53 | $this->container = new Container();  | 
                                                        
| 54 | 54 | |
| 55 | 55 | $this->container->bindSingleton(UriFactoryInterface::class, new Psr17Factory());  | 
                                                        
| 56 | -        $this->container->bindSingleton(RouterInterface::class, static function (UriHandler $handler, Container $container) { | 
                                                        |
| 56 | +        $this->container->bindSingleton(RouterInterface::class, static function (UriHandler $handler, Container $container){ | 
                                                        |
| 57 | 57 |              return new Router('/', $handler, $container); | 
                                                        
| 58 | 58 | });  | 
                                                        
| 59 | 59 | $this->container->bindSingleton(GroupRegistry::class, new GroupRegistry($this->container));  | 
                                                        
@@ -53,7 +53,8 @@  | 
                                                    ||
| 53 | 53 | $this->container = new Container();  | 
                                                        
| 54 | 54 | |
| 55 | 55 | $this->container->bindSingleton(UriFactoryInterface::class, new Psr17Factory());  | 
                                                        
| 56 | -        $this->container->bindSingleton(RouterInterface::class, static function (UriHandler $handler, Container $container) { | 
                                                        |
| 56 | + $this->container->bindSingleton(RouterInterface::class, static function (UriHandler $handler, Container $container)  | 
                                                        |
| 57 | +        { | 
                                                        |
| 57 | 58 |              return new Router('/', $handler, $container); | 
                                                        
| 58 | 59 | });  | 
                                                        
| 59 | 60 | $this->container->bindSingleton(GroupRegistry::class, new GroupRegistry($this->container));  | 
                                                        
@@ -27,8 +27,8 @@ discard block  | 
                                                    ||
| 27 | 27 |      { | 
                                                        
| 28 | 28 | $grid = $this->table(['Name:', 'Verbs:', 'Pattern:', 'Target:', 'Group:']);  | 
                                                        
| 29 | 29 | |
| 30 | -        foreach ($router->getRoutes() as $name => $route) { | 
                                                        |
| 31 | -            if ($route instanceof Route) { | 
                                                        |
| 30 | +        foreach ($router->getRoutes() as $name => $route){ | 
                                                        |
| 31 | +            if ($route instanceof Route){ | 
                                                        |
| 32 | 32 | $grid->addRow(  | 
                                                        
| 33 | 33 | [  | 
                                                        
| 34 | 34 | $name,  | 
                                                        
@@ -52,8 +52,8 @@ discard block  | 
                                                    ||
| 52 | 52 | private function getRouteGroups(GroupRegistry $registry, string $routeName): array  | 
                                                        
| 53 | 53 |      { | 
                                                        
| 54 | 54 | $groups = [];  | 
                                                        
| 55 | -        foreach ($registry as $groupName => $group) { | 
                                                        |
| 56 | -            if ($group->hasRoute($routeName)) { | 
                                                        |
| 55 | +        foreach ($registry as $groupName => $group){ | 
                                                        |
| 56 | +            if ($group->hasRoute($routeName)){ | 
                                                        |
| 57 | 57 | $groups[] = $groupName;  | 
                                                        
| 58 | 58 | }  | 
                                                        
| 59 | 59 | }  | 
                                                        
@@ -63,12 +63,12 @@ discard block  | 
                                                    ||
| 63 | 63 | |
| 64 | 64 | private function getVerbs(Route $route): string  | 
                                                        
| 65 | 65 |      { | 
                                                        
| 66 | -        if ($route->getVerbs() === Route::VERBS) { | 
                                                        |
| 66 | +        if ($route->getVerbs() === Route::VERBS){ | 
                                                        |
| 67 | 67 | return '*';  | 
                                                        
| 68 | 68 | }  | 
                                                        
| 69 | 69 | |
| 70 | 70 | $result = [];  | 
                                                        
| 71 | -        foreach ($route->getVerbs() as $verb) { | 
                                                        |
| 71 | +        foreach ($route->getVerbs() as $verb){ | 
                                                        |
| 72 | 72 |              $result[] = match (\strtolower($verb)) { | 
                                                        
| 73 | 73 | 'get' => '<fg=green>GET</>',  | 
                                                        
| 74 | 74 | 'post' => '<fg=blue>POST</>',  | 
                                                        
@@ -93,7 +93,7 @@ discard block  | 
                                                    ||
| 93 | 93 | return \preg_replace_callback(  | 
                                                        
| 94 | 94 | '/<([^>]*)>/',  | 
                                                        
| 95 | 95 |              static fn ($m) => \sprintf('<fg=magenta>%s</>', $m[0]), | 
                                                        
| 96 | - !empty($prefix) ? $prefix . '/' . \trim($pattern, '/') : $pattern  | 
                                                        |
| 96 | + !empty($prefix) ? $prefix.'/'.\trim($pattern, '/') : $pattern  | 
                                                        |
| 97 | 97 | );  | 
                                                        
| 98 | 98 | }  | 
                                                        
| 99 | 99 | |
@@ -104,7 +104,7 @@ discard block  | 
                                                    ||
| 104 | 104 | private function getTarget(Route $route, KernelInterface $kernel): string  | 
                                                        
| 105 | 105 |      { | 
                                                        
| 106 | 106 | $target = $this->getValue($route, 'target');  | 
                                                        
| 107 | -        switch (true) { | 
                                                        |
| 107 | +        switch (true){ | 
                                                        |
| 108 | 108 | case $target instanceof \Closure:  | 
                                                        
| 109 | 109 | $reflection = new \ReflectionFunction($target);  | 
                                                        
| 110 | 110 | |
@@ -129,7 +129,7 @@ discard block  | 
                                                    ||
| 129 | 129 | |
| 130 | 130 | case $target instanceof Group:  | 
                                                        
| 131 | 131 | $result = [];  | 
                                                        
| 132 | -                foreach ($this->getValue($target, 'controllers') as $alias => $class) { | 
                                                        |
| 132 | +                foreach ($this->getValue($target, 'controllers') as $alias => $class){ | 
                                                        |
| 133 | 133 |                      $result[] = \sprintf('%s => %s', $alias, $this->relativeClass($class, $kernel)); | 
                                                        
| 134 | 134 | }  | 
                                                        
| 135 | 135 | |
@@ -148,10 +148,10 @@ discard block  | 
                                                    ||
| 148 | 148 | |
| 149 | 149 | private function getValue(object $object, string $property): mixed  | 
                                                        
| 150 | 150 |      { | 
                                                        
| 151 | -        try { | 
                                                        |
| 151 | +        try{ | 
                                                        |
| 152 | 152 | $r = new \ReflectionObject($object);  | 
                                                        
| 153 | 153 | $prop = $r->getProperty($property);  | 
                                                        
| 154 | -        } catch (\Throwable $e) { | 
                                                        |
| 154 | +        }catch (\Throwable $e){ | 
                                                        |
| 155 | 155 | return $e->getMessage();  | 
                                                        
| 156 | 156 | }  | 
                                                        
| 157 | 157 | |
@@ -162,7 +162,7 @@ discard block  | 
                                                    ||
| 162 | 162 |      { | 
                                                        
| 163 | 163 | $r = new \ReflectionObject($kernel);  | 
                                                        
| 164 | 164 | |
| 165 | -        if (\str_starts_with($class, $r->getNamespaceName())) { | 
                                                        |
| 165 | +        if (\str_starts_with($class, $r->getNamespaceName())){ | 
                                                        |
| 166 | 166 | return \substr($class, \strlen($r->getNamespaceName()) + 1);  | 
                                                        
| 167 | 167 | }  | 
                                                        
| 168 | 168 | |
@@ -25,7 +25,7 @@ discard block  | 
                                                    ||
| 25 | 25 | /** @var array<class-string<MiddlewareInterface>|MiddlewareInterface|Autowire> */  | 
                                                        
| 26 | 26 | private array $middleware = [];  | 
                                                        
| 27 | 27 | |
| 28 | - private Autowire|CoreInterface|string|null $core = null;  | 
                                                        |
| 28 | + private Autowire | CoreInterface | string | null $core = null;  | 
                                                        |
| 29 | 29 | |
| 30 | 30 | public function __construct(  | 
                                                        
| 31 | 31 | /** @deprecated since v3.3.0 */  | 
                                                        
@@ -34,7 +34,7 @@ discard block  | 
                                                    ||
| 34 | 34 | private readonly ?RouterInterface $router = null,  | 
                                                        
| 35 | 35 | /** @deprecated since v3.3.0 */  | 
                                                        
| 36 | 36 | private readonly ?UriHandler $handler = null  | 
                                                        
| 37 | -    ) { | 
                                                        |
| 37 | +    ){ | 
                                                        |
| 38 | 38 | }  | 
                                                        
| 39 | 39 | |
| 40 | 40 | /**  | 
                                                        
@@ -65,7 +65,7 @@ discard block  | 
                                                    ||
| 65 | 65 | return $this;  | 
                                                        
| 66 | 66 | }  | 
                                                        
| 67 | 67 | |
| 68 | - public function setCore(Autowire|CoreInterface|string $core): self  | 
                                                        |
| 68 | + public function setCore(Autowire | CoreInterface | string $core): self  | 
                                                        |
| 69 | 69 |      { | 
                                                        
| 70 | 70 | $this->core = $core;  | 
                                                        
| 71 | 71 | |
@@ -75,7 +75,7 @@ discard block  | 
                                                    ||
| 75 | 75 | /**  | 
                                                        
| 76 | 76 | * @param MiddlewareInterface|Autowire|class-string<MiddlewareInterface>|non-empty-string $middleware  | 
                                                        
| 77 | 77 | */  | 
                                                        
| 78 | - public function addMiddleware(MiddlewareInterface|Autowire|string $middleware): self  | 
                                                        |
| 78 | + public function addMiddleware(MiddlewareInterface | Autowire | string $middleware): self  | 
                                                        |
| 79 | 79 |      { | 
                                                        
| 80 | 80 | $this->middleware[] = $middleware;  | 
                                                        
| 81 | 81 | |
@@ -89,21 +89,21 @@ discard block  | 
                                                    ||
| 89 | 89 | */  | 
                                                        
| 90 | 90 | public function register(RouterInterface $router, FactoryInterface $factory): void  | 
                                                        
| 91 | 91 |      { | 
                                                        
| 92 | -        foreach ($this->routes as $name => $route) { | 
                                                        |
| 93 | -            if ($this->core !== null) { | 
                                                        |
| 94 | -                if (!$this->core instanceof CoreInterface) { | 
                                                        |
| 92 | +        foreach ($this->routes as $name => $route){ | 
                                                        |
| 93 | +            if ($this->core !== null){ | 
                                                        |
| 94 | +                if (!$this->core instanceof CoreInterface){ | 
                                                        |
| 95 | 95 | $this->core = $factory->make($this->core);  | 
                                                        
| 96 | 96 | }  | 
                                                        
| 97 | 97 | |
| 98 | 98 | $target = $route->getTarget();  | 
                                                        
| 99 | -                if ($target instanceof AbstractTarget) { | 
                                                        |
| 99 | +                if ($target instanceof AbstractTarget){ | 
                                                        |
| 100 | 100 | $route = $route->withTarget($target->withCore($this->core));  | 
                                                        
| 101 | 101 | }  | 
                                                        
| 102 | 102 | }  | 
                                                        
| 103 | 103 | |
| 104 | -            try { | 
                                                        |
| 104 | +            try{ | 
                                                        |
| 105 | 105 | $uriHandler = $route->getUriHandler();  | 
                                                        
| 106 | -            } catch (\Throwable) { | 
                                                        |
| 106 | +            }catch (\Throwable){ | 
                                                        |
| 107 | 107 | $uriHandler = $factory->make(UriHandler::class);  | 
                                                        
| 108 | 108 | }  | 
                                                        
| 109 | 109 | |
@@ -119,7 +119,7 @@ discard block  | 
                                                    ||
| 119 | 119 | */  | 
                                                        
| 120 | 120 | public function addRoute(string $name, Route $route): self  | 
                                                        
| 121 | 121 |      { | 
                                                        
| 122 | - $this->routes[$this->namePrefix . $name] = $route;  | 
                                                        |
| 122 | + $this->routes[$this->namePrefix.$name] = $route;  | 
                                                        |
| 123 | 123 | |
| 124 | 124 | return $this;  | 
                                                        
| 125 | 125 | }  | 
                                                        
@@ -89,21 +89,28 @@  | 
                                                    ||
| 89 | 89 | */  | 
                                                        
| 90 | 90 | public function register(RouterInterface $router, FactoryInterface $factory): void  | 
                                                        
| 91 | 91 |      { | 
                                                        
| 92 | -        foreach ($this->routes as $name => $route) { | 
                                                        |
| 93 | -            if ($this->core !== null) { | 
                                                        |
| 94 | -                if (!$this->core instanceof CoreInterface) { | 
                                                        |
| 92 | + foreach ($this->routes as $name => $route)  | 
                                                        |
| 93 | +        { | 
                                                        |
| 94 | + if ($this->core !== null)  | 
                                                        |
| 95 | +            { | 
                                                        |
| 96 | + if (!$this->core instanceof CoreInterface)  | 
                                                        |
| 97 | +                { | 
                                                        |
| 95 | 98 | $this->core = $factory->make($this->core);  | 
                                                        
| 96 | 99 | }  | 
                                                        
| 97 | 100 | |
| 98 | 101 | $target = $route->getTarget();  | 
                                                        
| 99 | -                if ($target instanceof AbstractTarget) { | 
                                                        |
| 102 | + if ($target instanceof AbstractTarget)  | 
                                                        |
| 103 | +                { | 
                                                        |
| 100 | 104 | $route = $route->withTarget($target->withCore($this->core));  | 
                                                        
| 101 | 105 | }  | 
                                                        
| 102 | 106 | }  | 
                                                        
| 103 | 107 | |
| 104 | -            try { | 
                                                        |
| 108 | + try  | 
                                                        |
| 109 | +            { | 
                                                        |
| 105 | 110 | $uriHandler = $route->getUriHandler();  | 
                                                        
| 106 | -            } catch (\Throwable) { | 
                                                        |
| 111 | + }  | 
                                                        |
| 112 | + catch (\Throwable)  | 
                                                        |
| 113 | +            { | 
                                                        |
| 107 | 114 | $uriHandler = $factory->make(UriHandler::class);  | 
                                                        
| 108 | 115 | }  | 
                                                        
| 109 | 116 | |
@@ -18,12 +18,12 @@ discard block  | 
                                                    ||
| 18 | 18 | |
| 19 | 19 | public function __construct(  | 
                                                        
| 20 | 20 | private readonly FactoryInterface $factory  | 
                                                        
| 21 | -    ) { | 
                                                        |
| 21 | +    ){ | 
                                                        |
| 22 | 22 | }  | 
                                                        
| 23 | 23 | |
| 24 | 24 | public function getGroup(string $name): RouteGroup  | 
                                                        
| 25 | 25 |      { | 
                                                        
| 26 | -        if (!isset($this->groups[$name])) { | 
                                                        |
| 26 | +        if (!isset($this->groups[$name])){ | 
                                                        |
| 27 | 27 | $this->groups[$name] = $this->factory->make(RouteGroup::class);  | 
                                                        
| 28 | 28 | }  | 
                                                        
| 29 | 29 | |
@@ -49,7 +49,7 @@ discard block  | 
                                                    ||
| 49 | 49 | */  | 
                                                        
| 50 | 50 | public function registerRoutes(): void  | 
                                                        
| 51 | 51 |      { | 
                                                        
| 52 | -        foreach ($this->groups as $group) { | 
                                                        |
| 52 | +        foreach ($this->groups as $group){ | 
                                                        |
| 53 | 53 | $group->register($this->factory->make(RouterInterface::class), $this->factory);  | 
                                                        
| 54 | 54 | }  | 
                                                        
| 55 | 55 | }  | 
                                                        
@@ -23,7 +23,8 @@ discard block  | 
                                                    ||
| 23 | 23 | |
| 24 | 24 | public function getGroup(string $name): RouteGroup  | 
                                                        
| 25 | 25 |      { | 
                                                        
| 26 | -        if (!isset($this->groups[$name])) { | 
                                                        |
| 26 | + if (!isset($this->groups[$name]))  | 
                                                        |
| 27 | +        { | 
                                                        |
| 27 | 28 | $this->groups[$name] = $this->factory->make(RouteGroup::class);  | 
                                                        
| 28 | 29 | }  | 
                                                        
| 29 | 30 | |
@@ -49,7 +50,8 @@ discard block  | 
                                                    ||
| 49 | 50 | */  | 
                                                        
| 50 | 51 | public function registerRoutes(): void  | 
                                                        
| 51 | 52 |      { | 
                                                        
| 52 | -        foreach ($this->groups as $group) { | 
                                                        |
| 53 | + foreach ($this->groups as $group)  | 
                                                        |
| 54 | +        { | 
                                                        |
| 53 | 55 | $group->register($this->factory->make(RouterInterface::class), $this->factory);  | 
                                                        
| 54 | 56 | }  | 
                                                        
| 55 | 57 | }  |