@@ -40,15 +40,15 @@ discard block |
||
40 | 40 | $this->sprintf("<info>New encryption key:</info> <fg=cyan>%s</fg=cyan>\n", $key); |
41 | 41 | |
42 | 42 | $file = $this->option('mount'); |
43 | - if ($file === null) { |
|
43 | + if ($file === null){ |
|
44 | 44 | return self::SUCCESS; |
45 | 45 | } |
46 | 46 | |
47 | - if (!$confirmation->confirmToProceed()) { |
|
47 | + if (!$confirmation->confirmToProceed()){ |
|
48 | 48 | return self::FAILURE; |
49 | 49 | } |
50 | 50 | |
51 | - if (!$files->exists($file)) { |
|
51 | + if (!$files->exists($file)){ |
|
52 | 52 | $this->error(\sprintf('Unable to find `%s`.', $file)); |
53 | 53 | |
54 | 54 | return self::FAILURE; |
@@ -56,10 +56,10 @@ discard block |
||
56 | 56 | |
57 | 57 | $content = $files->read($file); |
58 | 58 | |
59 | - try { |
|
59 | + try{ |
|
60 | 60 | $content = \str_replace($this->option('placeholder'), $key, $content); |
61 | 61 | $content = \str_replace($enc->getKey(), $key, $content); |
62 | - } catch (\Throwable) { |
|
62 | + }catch (\Throwable){ |
|
63 | 63 | // current keys is not set |
64 | 64 | } |
65 | 65 |
@@ -40,15 +40,18 @@ discard block |
||
40 | 40 | $this->sprintf("<info>New encryption key:</info> <fg=cyan>%s</fg=cyan>\n", $key); |
41 | 41 | |
42 | 42 | $file = $this->option('mount'); |
43 | - if ($file === null) { |
|
43 | + if ($file === null) |
|
44 | + { |
|
44 | 45 | return self::SUCCESS; |
45 | 46 | } |
46 | 47 | |
47 | - if (!$confirmation->confirmToProceed()) { |
|
48 | + if (!$confirmation->confirmToProceed()) |
|
49 | + { |
|
48 | 50 | return self::FAILURE; |
49 | 51 | } |
50 | 52 | |
51 | - if (!$files->exists($file)) { |
|
53 | + if (!$files->exists($file)) |
|
54 | + { |
|
52 | 55 | $this->error(\sprintf('Unable to find `%s`.', $file)); |
53 | 56 | |
54 | 57 | return self::FAILURE; |
@@ -56,10 +59,13 @@ discard block |
||
56 | 59 | |
57 | 60 | $content = $files->read($file); |
58 | 61 | |
59 | - try { |
|
62 | + try |
|
63 | + { |
|
60 | 64 | $content = \str_replace($this->option('placeholder'), $key, $content); |
61 | 65 | $content = \str_replace($enc->getKey(), $key, $content); |
62 | - } catch (\Throwable) { |
|
66 | + } |
|
67 | + catch (\Throwable) |
|
68 | + { |
|
63 | 69 | // current keys is not set |
64 | 70 | } |
65 | 71 |
@@ -40,13 +40,13 @@ |
||
40 | 40 | |
41 | 41 | public function __construct( |
42 | 42 | private readonly ConfiguratorInterface $config |
43 | - ) { |
|
43 | + ){ |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | public function init(EnvironmentInterface $env, DirectoriesInterface $dirs, DebugMode $debugMode): void |
47 | 47 | { |
48 | - if (!$dirs->has('locale')) { |
|
49 | - $dirs->set('locale', $dirs->get('app') . 'locale/'); |
|
48 | + if (!$dirs->has('locale')){ |
|
49 | + $dirs->set('locale', $dirs->get('app').'locale/'); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | $this->config->setDefaults( |
@@ -45,7 +45,8 @@ |
||
45 | 45 | |
46 | 46 | public function init(EnvironmentInterface $env, DirectoriesInterface $dirs, DebugMode $debugMode): void |
47 | 47 | { |
48 | - if (!$dirs->has('locale')) { |
|
48 | + if (!$dirs->has('locale')) |
|
49 | + { |
|
49 | 50 | $dirs->set('locale', $dirs->get('app') . 'locale/'); |
50 | 51 | } |
51 | 52 |
@@ -37,8 +37,8 @@ |
||
37 | 37 | FilesInterface $files |
38 | 38 | ): FileSnapshot { |
39 | 39 | return new FileSnapshot( |
40 | - $dirs->get('runtime') . '/snapshots/', |
|
41 | - (int) $env->get('SNAPSHOT_MAX_FILES', self::MAX_SNAPSHOTS), |
|
40 | + $dirs->get('runtime').'/snapshots/', |
|
41 | + (int)$env->get('SNAPSHOT_MAX_FILES', self::MAX_SNAPSHOTS), |
|
42 | 42 | Verbosity::tryFrom((int)($env->get('SNAPSHOT_VERBOSITY') ?? Verbosity::VERBOSE->value)), |
43 | 43 | new PlainRenderer(), |
44 | 44 | $files |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | |
29 | 29 | public function __construct( |
30 | 30 | private readonly FactoryInterface $factory |
31 | - ) { |
|
31 | + ){ |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | /** |
@@ -36,8 +36,8 @@ discard block |
||
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 | } |
@@ -36,8 +36,10 @@ discard block |
||
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 | + { |
|
41 | + if (!$provider instanceof ActorProviderInterface) |
|
42 | + { |
|
41 | 43 | throw new AuthException( |
42 | 44 | \sprintf( |
43 | 45 | 'Expected `ActorProviderInterface`, got `%s`', |
@@ -47,12 +49,14 @@ discard block |
||
47 | 49 | } |
48 | 50 | |
49 | 51 | $actor = $provider->getActor($token); |
50 | - if ($actor !== null) { |
|
52 | + if ($actor !== null) |
|
53 | + { |
|
51 | 54 | return $actor; |
52 | 55 | } |
53 | 56 | } |
54 | 57 | |
55 | - if ($this->actorProvider === []) { |
|
58 | + if ($this->actorProvider === []) |
|
59 | + { |
|
56 | 60 | throw new AuthException('No actor provider'); |
57 | 61 | } |
58 | 62 | |
@@ -72,13 +76,16 @@ discard block |
||
72 | 76 | */ |
73 | 77 | private function getProviders(): \Generator |
74 | 78 | { |
75 | - foreach ($this->actorProvider as $provider) { |
|
76 | - if ($provider instanceof Autowire) { |
|
79 | + foreach ($this->actorProvider as $provider) |
|
80 | + { |
|
81 | + if ($provider instanceof Autowire) |
|
82 | + { |
|
77 | 83 | yield $provider->resolve($this->factory); |
78 | 84 | continue; |
79 | 85 | } |
80 | 86 | |
81 | - if (\is_object($provider)) { |
|
87 | + if (\is_object($provider)) |
|
88 | + { |
|
82 | 89 | yield $provider; |
83 | 90 | continue; |
84 | 91 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | |
30 | 30 | public function __construct( |
31 | 31 | private readonly FactoryInterface $factory |
32 | - ) { |
|
32 | + ){ |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | /** |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | /** |
44 | 44 | * @psalm-param class-string<StateCollectorInterface>|StateCollectorInterface $collector |
45 | 45 | */ |
46 | - public function addStateCollector(string|StateCollectorInterface $collector): void |
|
46 | + public function addStateCollector(string | StateCollectorInterface $collector): void |
|
47 | 47 | { |
48 | 48 | $this->collectors[] = $collector; |
49 | 49 | } |
@@ -55,14 +55,14 @@ discard block |
||
55 | 55 | { |
56 | 56 | $state = new State(); |
57 | 57 | |
58 | - foreach ($this->collectors as $collector) { |
|
58 | + foreach ($this->collectors as $collector){ |
|
59 | 59 | $collector = match (true) { |
60 | 60 | \is_string($collector) => $this->factory->make($collector), |
61 | 61 | $collector instanceof Autowire => $collector->resolve($this->factory), |
62 | 62 | default => $collector, |
63 | 63 | }; |
64 | 64 | |
65 | - if (!$collector instanceof StateCollectorInterface) { |
|
65 | + if (!$collector instanceof StateCollectorInterface){ |
|
66 | 66 | throw new StateException( |
67 | 67 | \sprintf( |
68 | 68 | 'Unable to populate state, invalid state collector %s', |
@@ -55,14 +55,16 @@ |
||
55 | 55 | { |
56 | 56 | $state = new State(); |
57 | 57 | |
58 | - foreach ($this->collectors as $collector) { |
|
58 | + foreach ($this->collectors as $collector) |
|
59 | + { |
|
59 | 60 | $collector = match (true) { |
60 | 61 | \is_string($collector) => $this->factory->make($collector), |
61 | 62 | $collector instanceof Autowire => $collector->resolve($this->factory), |
62 | 63 | default => $collector, |
63 | 64 | }; |
64 | 65 | |
65 | - if (!$collector instanceof StateCollectorInterface) { |
|
66 | + if (!$collector instanceof StateCollectorInterface) |
|
67 | + { |
|
66 | 68 | throw new StateException( |
67 | 69 | \sprintf( |
68 | 70 | 'Unable to populate state, invalid state collector %s', |
@@ -41,19 +41,19 @@ |
||
41 | 41 | |
42 | 42 | private function configureExtensions(ConsoleBootloader $console, ContainerInterface $container): void |
43 | 43 | { |
44 | - if ($container->has(TranslatorInterface::class)) { |
|
44 | + if ($container->has(TranslatorInterface::class)){ |
|
45 | 45 | $this->configureTranslator($console); |
46 | 46 | } |
47 | 47 | |
48 | - if ($container->has(ViewsInterface::class)) { |
|
48 | + if ($container->has(ViewsInterface::class)){ |
|
49 | 49 | $this->configureViews($console); |
50 | 50 | } |
51 | 51 | |
52 | - if ($container->has(EncryptionInterface::class)) { |
|
52 | + if ($container->has(EncryptionInterface::class)){ |
|
53 | 53 | $this->configureEncrypter($console); |
54 | 54 | } |
55 | 55 | |
56 | - if ($container->has(RouterInterface::class)) { |
|
56 | + if ($container->has(RouterInterface::class)){ |
|
57 | 57 | $console->addCommand(Router\ListCommand::class); |
58 | 58 | } |
59 | 59 | } |
@@ -41,19 +41,23 @@ |
||
41 | 41 | |
42 | 42 | private function configureExtensions(ConsoleBootloader $console, ContainerInterface $container): void |
43 | 43 | { |
44 | - if ($container->has(TranslatorInterface::class)) { |
|
44 | + if ($container->has(TranslatorInterface::class)) |
|
45 | + { |
|
45 | 46 | $this->configureTranslator($console); |
46 | 47 | } |
47 | 48 | |
48 | - if ($container->has(ViewsInterface::class)) { |
|
49 | + if ($container->has(ViewsInterface::class)) |
|
50 | + { |
|
49 | 51 | $this->configureViews($console); |
50 | 52 | } |
51 | 53 | |
52 | - if ($container->has(EncryptionInterface::class)) { |
|
54 | + if ($container->has(EncryptionInterface::class)) |
|
55 | + { |
|
53 | 56 | $this->configureEncrypter($console); |
54 | 57 | } |
55 | 58 | |
56 | - if ($container->has(RouterInterface::class)) { |
|
59 | + if ($container->has(RouterInterface::class)) |
|
60 | + { |
|
57 | 61 | $console->addCommand(Router\ListCommand::class); |
58 | 62 | } |
59 | 63 | } |
@@ -27,7 +27,7 @@ |
||
27 | 27 | ): InterceptableCore { |
28 | 28 | $interceptableCore = new InterceptableCore($core, $dispatcher); |
29 | 29 | |
30 | - foreach (static::INTERCEPTORS as $interceptor) { |
|
30 | + foreach (static::INTERCEPTORS as $interceptor){ |
|
31 | 31 | $interceptableCore->addInterceptor($container->get($interceptor)); |
32 | 32 | } |
33 | 33 |
@@ -27,7 +27,8 @@ |
||
27 | 27 | ): InterceptableCore { |
28 | 28 | $interceptableCore = new InterceptableCore($core, $dispatcher); |
29 | 29 | |
30 | - foreach (static::INTERCEPTORS as $interceptor) { |
|
30 | + foreach (static::INTERCEPTORS as $interceptor) |
|
31 | + { |
|
31 | 32 | $interceptableCore->addInterceptor($container->get($interceptor)); |
32 | 33 | } |
33 | 34 |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | private readonly ContainerInterface $container, |
39 | 39 | private readonly BinderInterface $binder, |
40 | 40 | private readonly ConfiguratorInterface $config |
41 | - ) { |
|
41 | + ){ |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | ): FilterProvider { |
90 | 90 | $core = new InterceptableCore(new Core(), $dispatcher); |
91 | 91 | |
92 | - foreach ($config->getInterceptors() as $interceptor) { |
|
92 | + foreach ($config->getInterceptors() as $interceptor){ |
|
93 | 93 | $core->addInterceptor($container->get($interceptor)); |
94 | 94 | } |
95 | 95 |
@@ -89,7 +89,8 @@ |
||
89 | 89 | ): FilterProvider { |
90 | 90 | $core = new InterceptableCore(new Core(), $dispatcher); |
91 | 91 | |
92 | - foreach ($config->getInterceptors() as $interceptor) { |
|
92 | + foreach ($config->getInterceptors() as $interceptor) |
|
93 | + { |
|
93 | 94 | $core->addInterceptor($container->get($interceptor)); |
94 | 95 | } |
95 | 96 |
@@ -21,12 +21,12 @@ |
||
21 | 21 | static function (ContainerInterface $container): ReaderInterface { |
22 | 22 | $factory = new Factory(); |
23 | 23 | |
24 | - if ($container->has(CacheInterface::class)) { |
|
24 | + if ($container->has(CacheInterface::class)){ |
|
25 | 25 | $cache = $container->get(CacheInterface::class); |
26 | 26 | \assert($cache instanceof CacheInterface); |
27 | 27 | |
28 | 28 | $factory = $factory->withCache($cache); |
29 | - } elseif ($container->has(CacheItemPoolInterface::class)) { |
|
29 | + } elseif ($container->has(CacheItemPoolInterface::class)){ |
|
30 | 30 | $cachePool = $container->get(CacheItemPoolInterface::class); |
31 | 31 | \assert($cachePool instanceof CacheItemPoolInterface); |
32 | 32 |
@@ -21,12 +21,15 @@ |
||
21 | 21 | static function (ContainerInterface $container): ReaderInterface { |
22 | 22 | $factory = new Factory(); |
23 | 23 | |
24 | - if ($container->has(CacheInterface::class)) { |
|
24 | + if ($container->has(CacheInterface::class)) |
|
25 | + { |
|
25 | 26 | $cache = $container->get(CacheInterface::class); |
26 | 27 | \assert($cache instanceof CacheInterface); |
27 | 28 | |
28 | 29 | $factory = $factory->withCache($cache); |
29 | - } elseif ($container->has(CacheItemPoolInterface::class)) { |
|
30 | + } |
|
31 | + elseif ($container->has(CacheItemPoolInterface::class)) |
|
32 | + { |
|
30 | 33 | $cachePool = $container->get(CacheItemPoolInterface::class); |
31 | 34 | \assert($cachePool instanceof CacheItemPoolInterface); |
32 | 35 |