@@ -19,7 +19,8 @@ discard block |
||
19 | 19 | { |
20 | 20 | public function init(HttpBootloader $http): void |
21 | 21 | { |
22 | - foreach ($this->globalMiddleware() as $middleware) { |
|
22 | + foreach ($this->globalMiddleware() as $middleware) |
|
23 | + { |
|
23 | 24 | $http->addMiddleware($middleware); |
24 | 25 | } |
25 | 26 | } |
@@ -61,7 +62,8 @@ discard block |
||
61 | 62 | |
62 | 63 | private function registerMiddlewareGroups(BinderInterface $binder, array $groups): void |
63 | 64 | { |
64 | - foreach ($groups as $group => $middleware) { |
|
65 | + foreach ($groups as $group => $middleware) |
|
66 | + { |
|
65 | 67 | $binder |
66 | 68 | ->getBinder('http') |
67 | 69 | ->bind( |
@@ -75,7 +77,8 @@ discard block |
||
75 | 77 | |
76 | 78 | private function registerMiddlewareForRouteGroups(GroupRegistry $registry, array $groups): void |
77 | 79 | { |
78 | - foreach ($groups as $group) { |
|
80 | + foreach ($groups as $group) |
|
81 | + { |
|
79 | 82 | $registry->getGroup($group)->addMiddleware('middleware:' . $group); |
80 | 83 | } |
81 | 84 | } |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | { |
18 | 18 | public function init(HttpBootloader $http): void |
19 | 19 | { |
20 | - foreach ($this->globalMiddleware() as $middleware) { |
|
20 | + foreach ($this->globalMiddleware() as $middleware){ |
|
21 | 21 | $http->addMiddleware($middleware); |
22 | 22 | } |
23 | 23 | } |
@@ -55,11 +55,11 @@ discard block |
||
55 | 55 | |
56 | 56 | private function registerMiddlewareGroups(BinderInterface $binder, array $groups): void |
57 | 57 | { |
58 | - foreach ($groups as $group => $middleware) { |
|
58 | + foreach ($groups as $group => $middleware){ |
|
59 | 59 | $binder |
60 | 60 | ->getBinder('http') |
61 | 61 | ->bind( |
62 | - 'middleware:' . $group, |
|
62 | + 'middleware:'.$group, |
|
63 | 63 | static function (FactoryInterface $factory) use ($middleware): LazyPipeline { |
64 | 64 | return $factory->make(LazyPipeline::class)->withAddedMiddleware(...$middleware); |
65 | 65 | }, |
@@ -69,8 +69,8 @@ discard block |
||
69 | 69 | |
70 | 70 | private function registerMiddlewareForRouteGroups(GroupRegistry $registry, array $groups): void |
71 | 71 | { |
72 | - foreach ($groups as $group) { |
|
73 | - $registry->getGroup($group)->addMiddleware('middleware:' . $group); |
|
72 | + foreach ($groups as $group){ |
|
73 | + $registry->getGroup($group)->addMiddleware('middleware:'.$group); |
|
74 | 74 | } |
75 | 75 | } |
76 | 76 | } |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | { |
21 | 21 | use ContainerTrait; |
22 | 22 | |
23 | - protected Pipeline|LazyPipeline|null $pipeline = null; |
|
23 | + protected Pipeline | LazyPipeline | null $pipeline = null; |
|
24 | 24 | |
25 | 25 | /** @psalm-var array<array-key, MiddlewareType> */ |
26 | 26 | protected array $middleware = []; |
@@ -44,16 +44,16 @@ discard block |
||
44 | 44 | $route = clone $this; |
45 | 45 | |
46 | 46 | // array fallback |
47 | - if (\count($middleware) === 1 && \is_array($middleware[0])) { |
|
47 | + if (\count($middleware) === 1 && \is_array($middleware[0])){ |
|
48 | 48 | $middleware = $middleware[0]; |
49 | 49 | } |
50 | 50 | |
51 | 51 | /** @var MiddlewareType[] $middleware */ |
52 | - foreach ($middleware as $item) { |
|
52 | + foreach ($middleware as $item){ |
|
53 | 53 | $route->middleware[] = $item; |
54 | 54 | } |
55 | 55 | |
56 | - if ($route->pipeline !== null) { |
|
56 | + if ($route->pipeline !== null){ |
|
57 | 57 | $route->pipeline = $route->makeLazyPipeline(); |
58 | 58 | } |
59 | 59 | |
@@ -80,11 +80,11 @@ discard block |
||
80 | 80 | protected function makePipeline(): Pipeline |
81 | 81 | { |
82 | 82 | \assert($this->container !== null); |
83 | - try { |
|
83 | + try{ |
|
84 | 84 | return $this->container |
85 | 85 | ->get(PipelineFactory::class) |
86 | 86 | ->createWithMiddleware($this->middleware); |
87 | - } catch (ContainerExceptionInterface $e) { |
|
87 | + }catch (ContainerExceptionInterface $e){ |
|
88 | 88 | throw new RouteException($e->getMessage(), $e->getCode(), $e); |
89 | 89 | } |
90 | 90 | } |
@@ -97,11 +97,11 @@ discard block |
||
97 | 97 | protected function makeLazyPipeline(): LazyPipeline |
98 | 98 | { |
99 | 99 | \assert($this->container !== null); |
100 | - try { |
|
100 | + try{ |
|
101 | 101 | /** @var LazyPipeline $pipeline */ |
102 | 102 | $pipeline = $this->container->get(LazyPipeline::class); |
103 | 103 | return $pipeline->withMiddleware(...$this->middleware); |
104 | - } catch (ContainerExceptionInterface $e) { |
|
104 | + }catch (ContainerExceptionInterface $e){ |
|
105 | 105 | throw new RouteException($e->getMessage(), $e->getCode(), $e); |
106 | 106 | } |
107 | 107 | } |
@@ -44,16 +44,19 @@ discard block |
||
44 | 44 | $route = clone $this; |
45 | 45 | |
46 | 46 | // array fallback |
47 | - if (\count($middleware) === 1 && \is_array($middleware[0])) { |
|
47 | + if (\count($middleware) === 1 && \is_array($middleware[0])) |
|
48 | + { |
|
48 | 49 | $middleware = $middleware[0]; |
49 | 50 | } |
50 | 51 | |
51 | 52 | /** @var MiddlewareType[] $middleware */ |
52 | - foreach ($middleware as $item) { |
|
53 | + foreach ($middleware as $item) |
|
54 | + { |
|
53 | 55 | $route->middleware[] = $item; |
54 | 56 | } |
55 | 57 | |
56 | - if ($route->pipeline !== null) { |
|
58 | + if ($route->pipeline !== null) |
|
59 | + { |
|
57 | 60 | $route->pipeline = $route->makeLazyPipeline(); |
58 | 61 | } |
59 | 62 | |
@@ -80,11 +83,14 @@ discard block |
||
80 | 83 | protected function makePipeline(): Pipeline |
81 | 84 | { |
82 | 85 | \assert($this->container !== null); |
83 | - try { |
|
86 | + try |
|
87 | + { |
|
84 | 88 | return $this->container |
85 | 89 | ->get(PipelineFactory::class) |
86 | 90 | ->createWithMiddleware($this->middleware); |
87 | - } catch (ContainerExceptionInterface $e) { |
|
91 | + } |
|
92 | + catch (ContainerExceptionInterface $e) |
|
93 | + { |
|
88 | 94 | throw new RouteException($e->getMessage(), $e->getCode(), $e); |
89 | 95 | } |
90 | 96 | } |
@@ -97,11 +103,14 @@ discard block |
||
97 | 103 | protected function makeLazyPipeline(): LazyPipeline |
98 | 104 | { |
99 | 105 | \assert($this->container !== null); |
100 | - try { |
|
106 | + try |
|
107 | + { |
|
101 | 108 | /** @var LazyPipeline $pipeline */ |
102 | 109 | $pipeline = $this->container->get(LazyPipeline::class); |
103 | 110 | return $pipeline->withMiddleware(...$this->middleware); |
104 | - } catch (ContainerExceptionInterface $e) { |
|
111 | + } |
|
112 | + catch (ContainerExceptionInterface $e) |
|
113 | + { |
|
105 | 114 | throw new RouteException($e->getMessage(), $e->getCode(), $e); |
106 | 115 | } |
107 | 116 | } |
@@ -6,7 +6,7 @@ |
||
6 | 6 | |
7 | 7 | final class UserContext |
8 | 8 | { |
9 | - private function __construct() {} |
|
9 | + private function __construct(){} |
|
10 | 10 | |
11 | 11 | public static function create(): self |
12 | 12 | { |
@@ -6,7 +6,9 @@ |
||
6 | 6 | |
7 | 7 | final class UserContext |
8 | 8 | { |
9 | - private function __construct() {} |
|
9 | + private function __construct() |
|
10 | + { |
|
11 | +} |
|
10 | 12 | |
11 | 13 | public static function create(): self |
12 | 14 | { |
@@ -8,7 +8,7 @@ |
||
8 | 8 | { |
9 | 9 | public function __construct( |
10 | 10 | private readonly UserContext $scope, |
11 | - ) {} |
|
11 | + ){} |
|
12 | 12 | |
13 | 13 | public function scope(): string |
14 | 14 | { |
@@ -8,7 +8,8 @@ |
||
8 | 8 | { |
9 | 9 | public function __construct( |
10 | 10 | private readonly UserContext $scope, |
11 | - ) {} |
|
11 | + ) { |
|
12 | +} |
|
12 | 13 | |
13 | 14 | public function scope(): string |
14 | 15 | { |
@@ -7,4 +7,4 @@ |
||
7 | 7 | /** |
8 | 8 | * Triggered before cache item is deleted. |
9 | 9 | */ |
10 | -final class KeyDeleting extends CacheEvent {} |
|
10 | +final class KeyDeleting extends CacheEvent{} |
@@ -7,4 +7,6 @@ |
||
7 | 7 | /** |
8 | 8 | * Triggered before cache item is deleted. |
9 | 9 | */ |
10 | -final class KeyDeleting extends CacheEvent {} |
|
10 | +final class KeyDeleting extends CacheEvent |
|
11 | +{ |
|
12 | +} |
@@ -16,15 +16,15 @@ |
||
16 | 16 | */ |
17 | 17 | public function __construct(array $loaders = []) |
18 | 18 | { |
19 | - foreach ($loaders as $loader) { |
|
19 | + foreach ($loaders as $loader){ |
|
20 | 20 | $this->addLoader($loader); |
21 | 21 | } |
22 | 22 | } |
23 | 23 | |
24 | - public function resolve(mixed $resource, ?string $type = null): LoaderInterface|false |
|
24 | + public function resolve(mixed $resource, ?string $type = null): LoaderInterface | false |
|
25 | 25 | { |
26 | - foreach ($this->loaders as $loader) { |
|
27 | - if ($loader->supports($resource, $type)) { |
|
26 | + foreach ($this->loaders as $loader){ |
|
27 | + if ($loader->supports($resource, $type)){ |
|
28 | 28 | return $loader; |
29 | 29 | } |
30 | 30 | } |
@@ -16,15 +16,18 @@ |
||
16 | 16 | */ |
17 | 17 | public function __construct(array $loaders = []) |
18 | 18 | { |
19 | - foreach ($loaders as $loader) { |
|
19 | + foreach ($loaders as $loader) |
|
20 | + { |
|
20 | 21 | $this->addLoader($loader); |
21 | 22 | } |
22 | 23 | } |
23 | 24 | |
24 | 25 | public function resolve(mixed $resource, ?string $type = null): LoaderInterface|false |
25 | 26 | { |
26 | - foreach ($this->loaders as $loader) { |
|
27 | - if ($loader->supports($resource, $type)) { |
|
27 | + foreach ($this->loaders as $loader) |
|
28 | + { |
|
29 | + if ($loader->supports($resource, $type)) |
|
30 | + { |
|
28 | 31 | return $loader; |
29 | 32 | } |
30 | 33 | } |
@@ -11,5 +11,5 @@ |
||
11 | 11 | * |
12 | 12 | * @param string|null $type The resource type or null if unknown |
13 | 13 | */ |
14 | - public function resolve(mixed $resource, ?string $type = null): LoaderInterface|false; |
|
14 | + public function resolve(mixed $resource, ?string $type = null): LoaderInterface | false; |
|
15 | 15 | } |
@@ -32,13 +32,13 @@ discard block |
||
32 | 32 | */ |
33 | 33 | protected function say(string $string, array $options = [], ?string $bundle = null): string |
34 | 34 | { |
35 | - if (Translator::isMessage($string)) { |
|
35 | + if (Translator::isMessage($string)){ |
|
36 | 36 | //Cut [[ and ]] |
37 | 37 | $string = \substr($string, 2, -2); |
38 | 38 | } |
39 | 39 | |
40 | 40 | $container = ContainerScope::getContainer(); |
41 | - if (empty($container) || !$container->has(TranslatorInterface::class)) { |
|
41 | + if (empty($container) || !$container->has(TranslatorInterface::class)){ |
|
42 | 42 | return Translator::interpolate($string, $options); |
43 | 43 | } |
44 | 44 | |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | */ |
48 | 48 | $translator = $container->get(TranslatorInterface::class); |
49 | 49 | |
50 | - if (\is_null($bundle)) { |
|
50 | + if (\is_null($bundle)){ |
|
51 | 51 | $bundle = $translator->getDomain(static::class); |
52 | 52 | } |
53 | 53 |
@@ -32,13 +32,15 @@ discard block |
||
32 | 32 | */ |
33 | 33 | protected function say(string $string, array $options = [], ?string $bundle = null): string |
34 | 34 | { |
35 | - if (Translator::isMessage($string)) { |
|
35 | + if (Translator::isMessage($string)) |
|
36 | + { |
|
36 | 37 | //Cut [[ and ]] |
37 | 38 | $string = \substr($string, 2, -2); |
38 | 39 | } |
39 | 40 | |
40 | 41 | $container = ContainerScope::getContainer(); |
41 | - if (empty($container) || !$container->has(TranslatorInterface::class)) { |
|
42 | + if (empty($container) || !$container->has(TranslatorInterface::class)) |
|
43 | + { |
|
42 | 44 | return Translator::interpolate($string, $options); |
43 | 45 | } |
44 | 46 | |
@@ -47,7 +49,8 @@ discard block |
||
47 | 49 | */ |
48 | 50 | $translator = $container->get(TranslatorInterface::class); |
49 | 51 | |
50 | - if (\is_null($bundle)) { |
|
52 | + if (\is_null($bundle)) |
|
53 | + { |
|
51 | 54 | $bundle = $translator->getDomain(static::class); |
52 | 55 | } |
53 | 56 |
@@ -43,5 +43,5 @@ |
||
43 | 43 | * |
44 | 44 | * @throws LoaderException |
45 | 45 | */ |
46 | - public function list(?string $namespace = null): array; |
|
46 | + public function list(?string $namespace = null) : array; |
|
47 | 47 | } |