@@ -16,11 +16,11 @@ |
||
16 | 16 | protected readonly UriInterface $uri, |
17 | 17 | protected readonly ResponseFactoryInterface $responseFactory, |
18 | 18 | protected readonly int $status = 302 |
19 | - ) { |
|
19 | + ){ |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | protected function denyAccess(Request $request, RequestHandlerInterface $handler): Response |
23 | 23 | { |
24 | - return $this->responseFactory->createResponse($this->status)->withHeader('Location', (string) $this->uri); |
|
24 | + return $this->responseFactory->createResponse($this->status)->withHeader('Location', (string)$this->uri); |
|
25 | 25 | } |
26 | 26 | } |
@@ -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 | } |
@@ -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']), |
@@ -21,15 +21,15 @@ discard block |
||
21 | 21 | public function __construct( |
22 | 22 | private readonly ReaderInterface $reader, |
23 | 23 | private readonly GroupRegistry $groups, |
24 | - ) { |
|
24 | + ){ |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | public function listen(ReflectionClass $class): void |
28 | 28 | { |
29 | - foreach ($class->getMethods() as $method) { |
|
29 | + foreach ($class->getMethods() as $method){ |
|
30 | 30 | $route = $this->reader->firstFunctionMetadata($method, Route::class); |
31 | 31 | |
32 | - if ($route === null) { |
|
32 | + if ($route === null){ |
|
33 | 33 | continue; |
34 | 34 | } |
35 | 35 | |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | $defaultGroup = $this->groups->getDefaultGroup(); |
43 | 43 | |
44 | 44 | $routes = []; |
45 | - foreach ($this->attributes as $classes) { |
|
45 | + foreach ($this->attributes as $classes){ |
|
46 | 46 | [$method, $route] = $classes; |
47 | 47 | $class = $method->getDeclaringClass(); |
48 | 48 | |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | |
67 | 67 | private function configureRoutes(array $routes): void |
68 | 68 | { |
69 | - foreach ($routes as $name => $schema) { |
|
69 | + foreach ($routes as $name => $schema){ |
|
70 | 70 | $route = new \Spiral\Router\Route( |
71 | 71 | $schema['pattern'], |
72 | 72 | 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)); |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | { |
17 | 17 | public function __construct( |
18 | 18 | private readonly ResponseFactoryInterface $responseFactory |
19 | - ) { |
|
19 | + ){ |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | public function renderException(Request $request, int $code, \Throwable $exception): Response |
@@ -25,10 +25,10 @@ discard block |
||
25 | 25 | $acceptItems = AcceptHeader::fromString($request->getHeaderLine('Accept'))->getAll(); |
26 | 26 | |
27 | 27 | $response = $this->responseFactory->createResponse($code); |
28 | - if ($acceptItems && $acceptItems[0]->getValue() === 'application/json') { |
|
28 | + if ($acceptItems && $acceptItems[0]->getValue() === 'application/json'){ |
|
29 | 29 | $response = $response->withHeader('Content-Type', 'application/json; charset=UTF-8'); |
30 | 30 | $response->getBody()->write(\json_encode(['status' => $code])); |
31 | - } else { |
|
31 | + }else{ |
|
32 | 32 | $response->getBody()->write("Error code: {$code}"); |
33 | 33 | } |
34 | 34 |
@@ -25,10 +25,13 @@ |
||
25 | 25 | $acceptItems = AcceptHeader::fromString($request->getHeaderLine('Accept'))->getAll(); |
26 | 26 | |
27 | 27 | $response = $this->responseFactory->createResponse($code); |
28 | - if ($acceptItems && $acceptItems[0]->getValue() === 'application/json') { |
|
28 | + if ($acceptItems && $acceptItems[0]->getValue() === 'application/json') |
|
29 | + { |
|
29 | 30 | $response = $response->withHeader('Content-Type', 'application/json; charset=UTF-8'); |
30 | 31 | $response->getBody()->write(\json_encode(['status' => $code])); |
31 | - } else { |
|
32 | + } |
|
33 | + else |
|
34 | + { |
|
32 | 35 | $response->getBody()->write("Error code: {$code}"); |
33 | 36 | } |
34 | 37 |
@@ -39,17 +39,23 @@ discard block |
||
39 | 39 | */ |
40 | 40 | public function process(Request $request, Handler $handler): Response |
41 | 41 | { |
42 | - try { |
|
42 | + try |
|
43 | + { |
|
43 | 44 | return $handler->handle($request); |
44 | - } catch (ClientException|RouterException $e) { |
|
45 | + } |
|
46 | + catch (ClientException|RouterException $e) |
|
47 | + { |
|
45 | 48 | $code = $e instanceof ClientException ? $e->getCode() : 404; |
46 | - } catch (\Throwable $e) { |
|
49 | + } |
|
50 | + catch (\Throwable $e) |
|
51 | + { |
|
47 | 52 | $code = 500; |
48 | 53 | } |
49 | 54 | |
50 | 55 | $this->errorHandler->report($e); |
51 | 56 | |
52 | - if (!$this->suppressErrors->suppressed()) { |
|
57 | + if (!$this->suppressErrors->suppressed()) |
|
58 | + { |
|
53 | 59 | return $this->renderError($request, $e, $code); |
54 | 60 | } |
55 | 61 | |
@@ -67,7 +73,8 @@ discard block |
||
67 | 73 | |
68 | 74 | [$format, $renderer] = $this->getRenderer($this->errorHandler, $request); |
69 | 75 | |
70 | - if ($format !== null) { |
|
76 | + if ($format !== null) |
|
77 | + { |
|
71 | 78 | $response = $response->withHeader('Content-Type', $format . '; charset=UTF-8'); |
72 | 79 | } |
73 | 80 | |
@@ -87,12 +94,15 @@ discard block |
||
87 | 94 | */ |
88 | 95 | private function getRenderer(ExceptionHandlerInterface $handler, Request $request): array |
89 | 96 | { |
90 | - if ($request->hasHeader('Accept')) { |
|
97 | + if ($request->hasHeader('Accept')) |
|
98 | + { |
|
91 | 99 | $acceptItems = AcceptHeader::fromString($request->getHeaderLine('Accept'))->getAll(); |
92 | - foreach ($acceptItems as $item) { |
|
100 | + foreach ($acceptItems as $item) |
|
101 | + { |
|
93 | 102 | $format = $item->getValue(); |
94 | 103 | $renderer = $handler->getRenderer($format); |
95 | - if ($renderer !== null) { |
|
104 | + if ($renderer !== null) |
|
105 | + { |
|
96 | 106 | return [$format, $renderer]; |
97 | 107 | } |
98 | 108 | } |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | private readonly ResponseFactoryInterface $responseFactory, |
33 | 33 | private readonly ExceptionHandlerInterface $errorHandler, |
34 | 34 | private readonly Verbosity $verbosity = Verbosity::VERBOSE, |
35 | - ) { |
|
35 | + ){ |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | /** |
@@ -41,17 +41,17 @@ discard block |
||
41 | 41 | */ |
42 | 42 | public function process(Request $request, Handler $handler): Response |
43 | 43 | { |
44 | - try { |
|
44 | + try{ |
|
45 | 45 | return $handler->handle($request); |
46 | - } catch (ClientException|RouterException $e) { |
|
46 | + }catch (ClientException | RouterException $e){ |
|
47 | 47 | $code = $e instanceof ClientException ? $e->getCode() : 404; |
48 | - } catch (\Throwable $e) { |
|
48 | + }catch (\Throwable $e){ |
|
49 | 49 | $code = 500; |
50 | 50 | } |
51 | 51 | |
52 | 52 | $this->errorHandler->report($e); |
53 | 53 | |
54 | - if (!$this->suppressErrors->suppressed()) { |
|
54 | + if (!$this->suppressErrors->suppressed()){ |
|
55 | 55 | return $this->renderError($request, $e, $code); |
56 | 56 | } |
57 | 57 | |
@@ -69,8 +69,8 @@ discard block |
||
69 | 69 | |
70 | 70 | [$format, $renderer] = $this->getRenderer($this->errorHandler, $request); |
71 | 71 | |
72 | - if ($format !== null) { |
|
73 | - $response = $response->withHeader('Content-Type', $format . '; charset=UTF-8'); |
|
72 | + if ($format !== null){ |
|
73 | + $response = $response->withHeader('Content-Type', $format.'; charset=UTF-8'); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | $response->getBody()->write( |
@@ -89,12 +89,12 @@ discard block |
||
89 | 89 | */ |
90 | 90 | private function getRenderer(ExceptionHandlerInterface $handler, Request $request): array |
91 | 91 | { |
92 | - if ($request->hasHeader('Accept')) { |
|
92 | + if ($request->hasHeader('Accept')){ |
|
93 | 93 | $acceptItems = AcceptHeader::fromString($request->getHeaderLine('Accept'))->getAll(); |
94 | - foreach ($acceptItems as $item) { |
|
94 | + foreach ($acceptItems as $item){ |
|
95 | 95 | $format = $item->getValue(); |
96 | 96 | $renderer = $handler->getRenderer($format); |
97 | - if ($renderer !== null) { |
|
97 | + if ($renderer !== null){ |
|
98 | 98 | return [$format, $renderer]; |
99 | 99 | } |
100 | 100 | } |
@@ -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 |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | /** @var array<MiddlewareType> */ |
28 | 28 | private array $middleware = []; |
29 | 29 | |
30 | - private Autowire|CoreInterface|string|null $core = null; |
|
30 | + private Autowire | CoreInterface | string | null $core = null; |
|
31 | 31 | |
32 | 32 | public function __construct( |
33 | 33 | /** @deprecated since v3.3.0 */ |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | private readonly ?RouterInterface $router = null, |
37 | 37 | /** @deprecated since v3.3.0 */ |
38 | 38 | private readonly ?UriHandler $handler = null |
39 | - ) { |
|
39 | + ){ |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | /** |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | return $this; |
68 | 68 | } |
69 | 69 | |
70 | - public function setCore(Autowire|CoreInterface|string $core): self |
|
70 | + public function setCore(Autowire | CoreInterface | string $core): self |
|
71 | 71 | { |
72 | 72 | $this->core = $core; |
73 | 73 | |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | /** |
78 | 78 | * @param MiddlewareType $middleware |
79 | 79 | */ |
80 | - public function addMiddleware(MiddlewareInterface|Autowire|string $middleware): self |
|
80 | + public function addMiddleware(MiddlewareInterface | Autowire | string $middleware): self |
|
81 | 81 | { |
82 | 82 | $this->middleware[] = $middleware; |
83 | 83 | |
@@ -91,21 +91,21 @@ discard block |
||
91 | 91 | */ |
92 | 92 | public function register(RouterInterface $router, FactoryInterface $factory): void |
93 | 93 | { |
94 | - foreach ($this->routes as $name => $route) { |
|
95 | - if ($this->core !== null) { |
|
96 | - if (!$this->core instanceof CoreInterface) { |
|
94 | + foreach ($this->routes as $name => $route){ |
|
95 | + if ($this->core !== null){ |
|
96 | + if (!$this->core instanceof CoreInterface){ |
|
97 | 97 | $this->core = $factory->make($this->core); |
98 | 98 | } |
99 | 99 | |
100 | 100 | $target = $route->getTarget(); |
101 | - if ($target instanceof AbstractTarget) { |
|
101 | + if ($target instanceof AbstractTarget){ |
|
102 | 102 | $route = $route->withTarget($target->withCore($this->core)); |
103 | 103 | } |
104 | 104 | } |
105 | 105 | |
106 | - try { |
|
106 | + try{ |
|
107 | 107 | $uriHandler = $route->getUriHandler(); |
108 | - } catch (\Throwable) { |
|
108 | + }catch (\Throwable){ |
|
109 | 109 | $uriHandler = $factory->make(UriHandler::class); |
110 | 110 | } |
111 | 111 | |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | { |
130 | 130 | \assert($route instanceof Route); |
131 | 131 | |
132 | - $this->routes[$this->namePrefix . $name] = $route; |
|
132 | + $this->routes[$this->namePrefix.$name] = $route; |
|
133 | 133 | |
134 | 134 | return $this; |
135 | 135 | } |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | |
51 | 51 | public function __construct( |
52 | 52 | private readonly ConfiguratorInterface $config |
53 | - ) { |
|
53 | + ){ |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | public function boot(AbstractKernel $kernel): void |
@@ -62,10 +62,10 @@ discard block |
||
62 | 62 | $groups->registerRoutes($router); |
63 | 63 | }; |
64 | 64 | |
65 | - if ($kernel instanceof Kernel) { |
|
65 | + if ($kernel instanceof Kernel){ |
|
66 | 66 | $kernel->appBooted($configuratorCallback); |
67 | 67 | $kernel->appBooted($groupsCallback); |
68 | - } else { |
|
68 | + }else{ |
|
69 | 69 | $kernel->booted($configuratorCallback); |
70 | 70 | $kernel->booted($groupsCallback); |
71 | 71 | } |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | private function route(ServerRequestInterface $request): RouteInterface |
96 | 96 | { |
97 | 97 | $route = $request->getAttribute(Router::ROUTE_ATTRIBUTE, null); |
98 | - if ($route === null) { |
|
98 | + if ($route === null){ |
|
99 | 99 | throw new ScopeException('Unable to resolve Route, invalid request scope'); |
100 | 100 | } |
101 | 101 |
@@ -62,10 +62,13 @@ discard block |
||
62 | 62 | $groups->registerRoutes($router); |
63 | 63 | }; |
64 | 64 | |
65 | - if ($kernel instanceof Kernel) { |
|
65 | + if ($kernel instanceof Kernel) |
|
66 | + { |
|
66 | 67 | $kernel->appBooted($configuratorCallback); |
67 | 68 | $kernel->appBooted($groupsCallback); |
68 | - } else { |
|
69 | + } |
|
70 | + else |
|
71 | + { |
|
69 | 72 | $kernel->booted($configuratorCallback); |
70 | 73 | $kernel->booted($groupsCallback); |
71 | 74 | } |
@@ -95,7 +98,8 @@ discard block |
||
95 | 98 | private function route(ServerRequestInterface $request): RouteInterface |
96 | 99 | { |
97 | 100 | $route = $request->getAttribute(Router::ROUTE_ATTRIBUTE, null); |
98 | - if ($route === null) { |
|
101 | + if ($route === null) |
|
102 | + { |
|
99 | 103 | throw new ScopeException('Unable to resolve Route, invalid request scope'); |
100 | 104 | } |
101 | 105 |