@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | public function __construct( |
23 | 23 | private readonly ConfiguratorInterface $config, |
24 | 24 | private readonly BinderInterface $binder, |
25 | - ) {} |
|
25 | + ){} |
|
26 | 26 | |
27 | 27 | public function defineBindings(): array |
28 | 28 | { |
@@ -53,12 +53,12 @@ discard block |
||
53 | 53 | |
54 | 54 | private function cookieQueue(ServerRequestInterface $request): CookieQueue |
55 | 55 | { |
56 | - try { |
|
56 | + try{ |
|
57 | 57 | return $request->getAttribute(CookieQueue::ATTRIBUTE) ?? throw new ContextualObjectNotFoundException( |
58 | 58 | CookieQueue::class, |
59 | 59 | CookieQueue::ATTRIBUTE, |
60 | 60 | ); |
61 | - } catch (InvalidRequestScopeException $e) { |
|
61 | + }catch (InvalidRequestScopeException $e){ |
|
62 | 62 | throw new InvalidRequestScopeException(CookieQueue::class, previous: $e); |
63 | 63 | } |
64 | 64 | } |
@@ -22,7 +22,8 @@ discard block |
||
22 | 22 | public function __construct( |
23 | 23 | private readonly ConfiguratorInterface $config, |
24 | 24 | private readonly BinderInterface $binder, |
25 | - ) {} |
|
25 | + ) { |
|
26 | +} |
|
26 | 27 | |
27 | 28 | public function defineBindings(): array |
28 | 29 | { |
@@ -53,12 +54,15 @@ discard block |
||
53 | 54 | |
54 | 55 | private function cookieQueue(ServerRequestInterface $request): CookieQueue |
55 | 56 | { |
56 | - try { |
|
57 | + try |
|
58 | + { |
|
57 | 59 | return $request->getAttribute(CookieQueue::ATTRIBUTE) ?? throw new ContextualObjectNotFoundException( |
58 | 60 | CookieQueue::class, |
59 | 61 | CookieQueue::ATTRIBUTE, |
60 | 62 | ); |
61 | - } catch (InvalidRequestScopeException $e) { |
|
63 | + } |
|
64 | + catch (InvalidRequestScopeException $e) |
|
65 | + { |
|
62 | 66 | throw new InvalidRequestScopeException(CookieQueue::class, previous: $e); |
63 | 67 | } |
64 | 68 | } |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | public function __construct( |
38 | 38 | private readonly ConfiguratorInterface $config, |
39 | 39 | private readonly BinderInterface $binder, |
40 | - ) {} |
|
40 | + ){} |
|
41 | 41 | |
42 | 42 | public function defineDependencies(): array |
43 | 43 | { |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | * |
117 | 117 | * @psalm-param MiddlewareInterface|Autowire|class-string<MiddlewareInterface> Middleware definition |
118 | 118 | */ |
119 | - public function addMiddleware(string|Autowire|MiddlewareInterface $middleware): void |
|
119 | + public function addMiddleware(string | Autowire | MiddlewareInterface $middleware): void |
|
120 | 120 | { |
121 | 121 | $this->config->modify(HttpConfig::CONFIG, new Append('middleware', null, $middleware)); |
122 | 122 | } |
@@ -37,7 +37,8 @@ |
||
37 | 37 | public function __construct( |
38 | 38 | private readonly ConfiguratorInterface $config, |
39 | 39 | private readonly BinderInterface $binder, |
40 | - ) {} |
|
40 | + ) { |
|
41 | +} |
|
41 | 42 | |
42 | 43 | public function defineDependencies(): array |
43 | 44 | { |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | public function __construct( |
42 | 42 | private readonly ConfiguratorInterface $config, |
43 | 43 | private readonly BinderInterface $binder, |
44 | - ) {} |
|
44 | + ){} |
|
45 | 45 | |
46 | 46 | public function defineDependencies(): array |
47 | 47 | { |
@@ -79,10 +79,10 @@ discard block |
||
79 | 79 | $groups->registerRoutes($router); |
80 | 80 | }; |
81 | 81 | |
82 | - if ($kernel instanceof Kernel) { |
|
82 | + if ($kernel instanceof Kernel){ |
|
83 | 83 | $kernel->appBooted($configuratorCallback); |
84 | 84 | $kernel->appBooted($groupsCallback); |
85 | - } else { |
|
85 | + }else{ |
|
86 | 86 | $kernel->booted($configuratorCallback); |
87 | 87 | $kernel->booted($groupsCallback); |
88 | 88 | } |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | private function route(ServerRequestInterface $request): RouteInterface |
120 | 120 | { |
121 | 121 | $route = $request->getAttribute(Router::ROUTE_ATTRIBUTE, null); |
122 | - if ($route === null) { |
|
122 | + if ($route === null){ |
|
123 | 123 | throw new ScopeException('Unable to resolve Route, invalid request scope'); |
124 | 124 | } |
125 | 125 |
@@ -41,7 +41,8 @@ discard block |
||
41 | 41 | public function __construct( |
42 | 42 | private readonly ConfiguratorInterface $config, |
43 | 43 | private readonly BinderInterface $binder, |
44 | - ) {} |
|
44 | + ) { |
|
45 | +} |
|
45 | 46 | |
46 | 47 | public function defineDependencies(): array |
47 | 48 | { |
@@ -79,10 +80,13 @@ discard block |
||
79 | 80 | $groups->registerRoutes($router); |
80 | 81 | }; |
81 | 82 | |
82 | - if ($kernel instanceof Kernel) { |
|
83 | + if ($kernel instanceof Kernel) |
|
84 | + { |
|
83 | 85 | $kernel->appBooted($configuratorCallback); |
84 | 86 | $kernel->appBooted($groupsCallback); |
85 | - } else { |
|
87 | + } |
|
88 | + else |
|
89 | + { |
|
86 | 90 | $kernel->booted($configuratorCallback); |
87 | 91 | $kernel->booted($groupsCallback); |
88 | 92 | } |
@@ -119,7 +123,8 @@ discard block |
||
119 | 123 | private function route(ServerRequestInterface $request): RouteInterface |
120 | 124 | { |
121 | 125 | $route = $request->getAttribute(Router::ROUTE_ATTRIBUTE, null); |
122 | - if ($route === null) { |
|
126 | + if ($route === null) |
|
127 | + { |
|
123 | 128 | throw new ScopeException('Unable to resolve Route, invalid request scope'); |
124 | 129 | } |
125 | 130 |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | { |
27 | 27 | public function __construct( |
28 | 28 | private readonly BinderInterface $binder, |
29 | - ) {} |
|
29 | + ){} |
|
30 | 30 | |
31 | 31 | public function defineBindings(): array |
32 | 32 | { |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | 'handler' => new Autowire( |
71 | 71 | FileHandler::class, |
72 | 72 | [ |
73 | - 'directory' => $directories->get('runtime') . 'session', |
|
73 | + 'directory' => $directories->get('runtime').'session', |
|
74 | 74 | 'lifetime' => 86400, |
75 | 75 | ], |
76 | 76 | ), |
@@ -89,14 +89,14 @@ discard block |
||
89 | 89 | |
90 | 90 | private function resolveSession(ContainerInterface $container): SessionInterface |
91 | 91 | { |
92 | - try { |
|
92 | + try{ |
|
93 | 93 | /** @var ServerRequestInterface $request */ |
94 | 94 | $request = $container->get(ServerRequestInterface::class); |
95 | 95 | return $request->getAttribute(SessionMiddleware::ATTRIBUTE) ?? throw new ContextualObjectNotFoundException( |
96 | 96 | SessionInterface::class, |
97 | 97 | SessionMiddleware::ATTRIBUTE, |
98 | 98 | ); |
99 | - } catch (InvalidRequestScopeException $e) { |
|
99 | + }catch (InvalidRequestScopeException $e){ |
|
100 | 100 | throw new InvalidRequestScopeException(SessionInterface::class, previous: $e); |
101 | 101 | } |
102 | 102 | } |
@@ -26,7 +26,8 @@ discard block |
||
26 | 26 | { |
27 | 27 | public function __construct( |
28 | 28 | private readonly BinderInterface $binder, |
29 | - ) {} |
|
29 | + ) { |
|
30 | +} |
|
30 | 31 | |
31 | 32 | public function defineBindings(): array |
32 | 33 | { |
@@ -89,14 +90,17 @@ discard block |
||
89 | 90 | |
90 | 91 | private function resolveSession(ContainerInterface $container): SessionInterface |
91 | 92 | { |
92 | - try { |
|
93 | + try |
|
94 | + { |
|
93 | 95 | /** @var ServerRequestInterface $request */ |
94 | 96 | $request = $container->get(ServerRequestInterface::class); |
95 | 97 | return $request->getAttribute(SessionMiddleware::ATTRIBUTE) ?? throw new ContextualObjectNotFoundException( |
96 | 98 | SessionInterface::class, |
97 | 99 | SessionMiddleware::ATTRIBUTE, |
98 | 100 | ); |
99 | - } catch (InvalidRequestScopeException $e) { |
|
101 | + } |
|
102 | + catch (InvalidRequestScopeException $e) |
|
103 | + { |
|
100 | 104 | throw new InvalidRequestScopeException(SessionInterface::class, previous: $e); |
101 | 105 | } |
102 | 106 | } |
@@ -12,7 +12,7 @@ |
||
12 | 12 | { |
13 | 13 | public function __construct( |
14 | 14 | private readonly ConfiguratorInterface $config, |
15 | - ) {} |
|
15 | + ){} |
|
16 | 16 | |
17 | 17 | public function init(HttpBootloader $http): void |
18 | 18 | { |
@@ -12,7 +12,8 @@ |
||
12 | 12 | { |
13 | 13 | public function __construct( |
14 | 14 | private readonly ConfiguratorInterface $config, |
15 | - ) {} |
|
15 | + ) { |
|
16 | +} |
|
16 | 17 | |
17 | 18 | public function init(HttpBootloader $http): void |
18 | 19 | { |
@@ -32,7 +32,7 @@ |
||
32 | 32 | { |
33 | 33 | $bucket = $env->get('SNAPSHOTS_BUCKET'); |
34 | 34 | |
35 | - if ($bucket === null) { |
|
35 | + if ($bucket === null){ |
|
36 | 36 | throw new \RuntimeException( |
37 | 37 | 'Please, configure a bucket for storing snapshots using the environment variable `SNAPSHOTS_BUCKET`.', |
38 | 38 | ); |
@@ -32,7 +32,8 @@ |
||
32 | 32 | { |
33 | 33 | $bucket = $env->get('SNAPSHOTS_BUCKET'); |
34 | 34 | |
35 | - if ($bucket === null) { |
|
35 | + if ($bucket === null) |
|
36 | + { |
|
36 | 37 | throw new \RuntimeException( |
37 | 38 | 'Please, configure a bucket for storing snapshots using the environment variable `SNAPSHOTS_BUCKET`.', |
38 | 39 | ); |
@@ -36,9 +36,9 @@ |
||
36 | 36 | FilesInterface $files, |
37 | 37 | ): FileSnapshot { |
38 | 38 | return new FileSnapshot( |
39 | - $dirs->get('runtime') . '/snapshots/', |
|
40 | - (int) $env->get('SNAPSHOT_MAX_FILES', self::MAX_SNAPSHOTS), |
|
41 | - Verbosity::tryFrom((int) ($env->get('SNAPSHOT_VERBOSITY') ?? Verbosity::VERBOSE->value)), |
|
39 | + $dirs->get('runtime').'/snapshots/', |
|
40 | + (int)$env->get('SNAPSHOT_MAX_FILES', self::MAX_SNAPSHOTS), |
|
41 | + Verbosity::tryFrom((int)($env->get('SNAPSHOT_VERBOSITY') ?? Verbosity::VERBOSE->value)), |
|
42 | 42 | new PlainRenderer(), |
43 | 43 | $files, |
44 | 44 | ); |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | { |
42 | 42 | public function __construct( |
43 | 43 | private readonly ConfiguratorInterface $config, |
44 | - ) {} |
|
44 | + ){} |
|
45 | 45 | |
46 | 46 | public function defineDependencies(): array |
47 | 47 | { |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | $httpBinder->bindSingleton(TokenStorageInterface::class, [self::class, 'getTokenStorage']); |
77 | 77 | $httpBinder->bind( |
78 | 78 | AuthContextInterface::class, |
79 | - static fn(?ServerRequestInterface $request): AuthContextInterface => |
|
79 | + static fn(?ServerRequestInterface $request) : AuthContextInterface => |
|
80 | 80 | ($request ?? throw new InvalidRequestScopeException(AuthContextInterface::class)) |
81 | 81 | ->getAttribute(AuthMiddleware::ATTRIBUTE) ?? throw new ContextualObjectNotFoundException( |
82 | 82 | AuthContextInterface::class, |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | * @param non-empty-string $name |
111 | 111 | * @param Autowire|HttpTransportInterface|class-string<HttpTransportInterface> $transport |
112 | 112 | */ |
113 | - public function addTransport(string $name, Autowire|HttpTransportInterface|string $transport): void |
|
113 | + public function addTransport(string $name, Autowire | HttpTransportInterface | string $transport): void |
|
114 | 114 | { |
115 | 115 | $this->config->modify(AuthConfig::CONFIG, new Append('transports', $name, $transport)); |
116 | 116 | } |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | * @param non-empty-string $name |
122 | 122 | * @param Autowire|TokenStorageInterface|class-string<TokenStorageInterface> $storage |
123 | 123 | */ |
124 | - public function addTokenStorage(string $name, Autowire|TokenStorageInterface|string $storage): void |
|
124 | + public function addTokenStorage(string $name, Autowire | TokenStorageInterface | string $storage): void |
|
125 | 125 | { |
126 | 126 | $this->config->modify(AuthConfig::CONFIG, new Append('storages', $name, $storage)); |
127 | 127 | } |
@@ -144,8 +144,8 @@ discard block |
||
144 | 144 | $registry = new TransportRegistry(); |
145 | 145 | $registry->setDefaultTransport($config->getDefaultTransport()); |
146 | 146 | |
147 | - foreach ($config->getTransports() as $name => $transport) { |
|
148 | - if ($transport instanceof Autowire) { |
|
147 | + foreach ($config->getTransports() as $name => $transport){ |
|
148 | + if ($transport instanceof Autowire){ |
|
149 | 149 | $transport = $transport->resolve($factory); |
150 | 150 | } |
151 | 151 |
@@ -41,7 +41,8 @@ discard block |
||
41 | 41 | { |
42 | 42 | public function __construct( |
43 | 43 | private readonly ConfiguratorInterface $config, |
44 | - ) {} |
|
44 | + ) { |
|
45 | +} |
|
45 | 46 | |
46 | 47 | public function defineDependencies(): array |
47 | 48 | { |
@@ -144,8 +145,10 @@ discard block |
||
144 | 145 | $registry = new TransportRegistry(); |
145 | 146 | $registry->setDefaultTransport($config->getDefaultTransport()); |
146 | 147 | |
147 | - foreach ($config->getTransports() as $name => $transport) { |
|
148 | - if ($transport instanceof Autowire) { |
|
148 | + foreach ($config->getTransports() as $name => $transport) |
|
149 | + { |
|
150 | + if ($transport instanceof Autowire) |
|
151 | + { |
|
149 | 152 | $transport = $transport->resolve($factory); |
150 | 153 | } |
151 | 154 |
@@ -29,15 +29,15 @@ discard block |
||
29 | 29 | |
30 | 30 | public function __construct( |
31 | 31 | private readonly FactoryInterface $factory, |
32 | - ) {} |
|
32 | + ){} |
|
33 | 33 | |
34 | 34 | /** |
35 | 35 | * Find actor by first matching actor provider. |
36 | 36 | */ |
37 | 37 | public function getActor(TokenInterface $token): ?object |
38 | 38 | { |
39 | - foreach ($this->getProviders() as $provider) { |
|
40 | - if (!$provider instanceof ActorProviderInterface) { |
|
39 | + foreach ($this->getProviders() as $provider){ |
|
40 | + if (!$provider instanceof ActorProviderInterface){ |
|
41 | 41 | throw new AuthException( |
42 | 42 | \sprintf( |
43 | 43 | 'Expected `ActorProviderInterface`, got `%s`', |
@@ -47,12 +47,12 @@ discard block |
||
47 | 47 | } |
48 | 48 | |
49 | 49 | $actor = $provider->getActor($token); |
50 | - if ($actor !== null) { |
|
50 | + if ($actor !== null){ |
|
51 | 51 | return $actor; |
52 | 52 | } |
53 | 53 | } |
54 | 54 | |
55 | - if ($this->actorProvider === []) { |
|
55 | + if ($this->actorProvider === []){ |
|
56 | 56 | throw new AuthException('No actor provider'); |
57 | 57 | } |
58 | 58 | |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | /** |
63 | 63 | * Register new actor provider. |
64 | 64 | */ |
65 | - public function addActorProvider(ActorProviderInterface|Autowire|string $actorProvider): void |
|
65 | + public function addActorProvider(ActorProviderInterface | Autowire | string $actorProvider): void |
|
66 | 66 | { |
67 | 67 | $this->actorProvider[] = $actorProvider; |
68 | 68 | } |
@@ -72,13 +72,13 @@ discard block |
||
72 | 72 | */ |
73 | 73 | private function getProviders(): \Generator |
74 | 74 | { |
75 | - foreach ($this->actorProvider as $provider) { |
|
76 | - if ($provider instanceof Autowire) { |
|
75 | + foreach ($this->actorProvider as $provider){ |
|
76 | + if ($provider instanceof Autowire){ |
|
77 | 77 | yield $provider->resolve($this->factory); |
78 | 78 | continue; |
79 | 79 | } |
80 | 80 | |
81 | - if (\is_object($provider)) { |
|
81 | + if (\is_object($provider)){ |
|
82 | 82 | yield $provider; |
83 | 83 | continue; |
84 | 84 | } |
@@ -29,15 +29,18 @@ discard block |
||
29 | 29 | |
30 | 30 | public function __construct( |
31 | 31 | private readonly FactoryInterface $factory, |
32 | - ) {} |
|
32 | + ) { |
|
33 | +} |
|
33 | 34 | |
34 | 35 | /** |
35 | 36 | * Find actor by first matching actor provider. |
36 | 37 | */ |
37 | 38 | public function getActor(TokenInterface $token): ?object |
38 | 39 | { |
39 | - foreach ($this->getProviders() as $provider) { |
|
40 | - if (!$provider instanceof ActorProviderInterface) { |
|
40 | + foreach ($this->getProviders() as $provider) |
|
41 | + { |
|
42 | + if (!$provider instanceof ActorProviderInterface) |
|
43 | + { |
|
41 | 44 | throw new AuthException( |
42 | 45 | \sprintf( |
43 | 46 | 'Expected `ActorProviderInterface`, got `%s`', |
@@ -47,12 +50,14 @@ discard block |
||
47 | 50 | } |
48 | 51 | |
49 | 52 | $actor = $provider->getActor($token); |
50 | - if ($actor !== null) { |
|
53 | + if ($actor !== null) |
|
54 | + { |
|
51 | 55 | return $actor; |
52 | 56 | } |
53 | 57 | } |
54 | 58 | |
55 | - if ($this->actorProvider === []) { |
|
59 | + if ($this->actorProvider === []) |
|
60 | + { |
|
56 | 61 | throw new AuthException('No actor provider'); |
57 | 62 | } |
58 | 63 | |
@@ -72,13 +77,16 @@ discard block |
||
72 | 77 | */ |
73 | 78 | private function getProviders(): \Generator |
74 | 79 | { |
75 | - foreach ($this->actorProvider as $provider) { |
|
76 | - if ($provider instanceof Autowire) { |
|
80 | + foreach ($this->actorProvider as $provider) |
|
81 | + { |
|
82 | + if ($provider instanceof Autowire) |
|
83 | + { |
|
77 | 84 | yield $provider->resolve($this->factory); |
78 | 85 | continue; |
79 | 86 | } |
80 | 87 | |
81 | - if (\is_object($provider)) { |
|
88 | + if (\is_object($provider)) |
|
89 | + { |
|
82 | 90 | yield $provider; |
83 | 91 | continue; |
84 | 92 | } |