@@ -29,8 +29,10 @@ discard block |
||
29 | 29 | public function allows(string $permission, array $context = []): bool |
30 | 30 | { |
31 | 31 | $allows = false; |
32 | - foreach ($this->getRoles() as $role) { |
|
33 | - if (!$this->permissions->hasRole($role)) { |
|
32 | + foreach ($this->getRoles() as $role) |
|
33 | + { |
|
34 | + if (!$this->permissions->hasRole($role)) |
|
35 | + { |
|
34 | 36 | continue; |
35 | 37 | } |
36 | 38 | |
@@ -70,13 +72,17 @@ discard block |
||
70 | 72 | */ |
71 | 73 | public function getActor(): ActorInterface |
72 | 74 | { |
73 | - if (!\is_null($this->actor)) { |
|
75 | + if (!\is_null($this->actor)) |
|
76 | + { |
|
74 | 77 | return $this->actor; |
75 | 78 | } |
76 | 79 | |
77 | - try { |
|
80 | + try |
|
81 | + { |
|
78 | 82 | return $this->container->get(ActorInterface::class); |
79 | - } catch (NotFoundExceptionInterface $e) { |
|
83 | + } |
|
84 | + catch (NotFoundExceptionInterface $e) |
|
85 | + { |
|
80 | 86 | throw new ScopeException('Unable to resolve Actor from the scope', $e->getCode(), $e); |
81 | 87 | } |
82 | 88 | } |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | private readonly PermissionsInterface $permissions, |
23 | 23 | #[Proxy] private readonly ContainerInterface $container, |
24 | 24 | private array $roles = [] |
25 | - ) { |
|
25 | + ){ |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | /** |
@@ -31,8 +31,8 @@ discard block |
||
31 | 31 | public function allows(string $permission, array $context = []): bool |
32 | 32 | { |
33 | 33 | $allows = false; |
34 | - foreach ($this->getRoles() as $role) { |
|
35 | - if (!$this->permissions->hasRole($role)) { |
|
34 | + foreach ($this->getRoles() as $role){ |
|
35 | + if (!$this->permissions->hasRole($role)){ |
|
36 | 36 | continue; |
37 | 37 | } |
38 | 38 | |
@@ -72,13 +72,13 @@ discard block |
||
72 | 72 | */ |
73 | 73 | public function getActor(): ActorInterface |
74 | 74 | { |
75 | - if (!\is_null($this->actor)) { |
|
75 | + if (!\is_null($this->actor)){ |
|
76 | 76 | return $this->actor; |
77 | 77 | } |
78 | 78 | |
79 | - try { |
|
79 | + try{ |
|
80 | 80 | return $this->container->get(ActorInterface::class); |
81 | - } catch (NotFoundExceptionInterface $e) { |
|
81 | + }catch (NotFoundExceptionInterface $e){ |
|
82 | 82 | throw new ScopeException('Unable to resolve Actor from the scope', $e->getCode(), $e); |
83 | 83 | } |
84 | 84 | } |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | |
24 | 24 | public function populate(StateInterface $state): void |
25 | 25 | { |
26 | - if ($this->request === null) { |
|
26 | + if ($this->request === null){ |
|
27 | 27 | return; |
28 | 28 | } |
29 | 29 | |
@@ -32,11 +32,11 @@ discard block |
||
32 | 32 | |
33 | 33 | $state->setVariable('headers', $this->request->getHeaders()); |
34 | 34 | |
35 | - if ($this->request->getQueryParams() !== []) { |
|
35 | + if ($this->request->getQueryParams() !== []){ |
|
36 | 36 | $state->setVariable('query', $this->request->getQueryParams()); |
37 | 37 | } |
38 | 38 | |
39 | - if ($this->request->getParsedBody() !== null) { |
|
39 | + if ($this->request->getParsedBody() !== null){ |
|
40 | 40 | $state->setVariable('data', $this->request->getParsedBody()); |
41 | 41 | } |
42 | 42 | } |
@@ -23,7 +23,8 @@ discard block |
||
23 | 23 | |
24 | 24 | public function populate(StateInterface $state): void |
25 | 25 | { |
26 | - if ($this->request === null) { |
|
26 | + if ($this->request === null) |
|
27 | + { |
|
27 | 28 | return; |
28 | 29 | } |
29 | 30 | |
@@ -32,11 +33,13 @@ discard block |
||
32 | 33 | |
33 | 34 | $state->setVariable('headers', $this->request->getHeaders()); |
34 | 35 | |
35 | - if ($this->request->getQueryParams() !== []) { |
|
36 | + if ($this->request->getQueryParams() !== []) |
|
37 | + { |
|
36 | 38 | $state->setVariable('query', $this->request->getQueryParams()); |
37 | 39 | } |
38 | 40 | |
39 | - if ($this->request->getParsedBody() !== null) { |
|
41 | + if ($this->request->getParsedBody() !== null) |
|
42 | + { |
|
40 | 43 | $state->setVariable('data', $this->request->getParsedBody()); |
41 | 44 | } |
42 | 45 | } |
@@ -15,14 +15,14 @@ |
||
15 | 15 | public function __construct( |
16 | 16 | private readonly ContainerInterface $container, |
17 | 17 | private readonly EnvironmentInterface $env |
18 | - ) { |
|
18 | + ){ |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | public function populate(StateInterface $state): void |
22 | 22 | { |
23 | 23 | $state->setTag('php', \phpversion()); |
24 | 24 | |
25 | - if ($this->container->has(DispatcherInterface::class)) { |
|
25 | + if ($this->container->has(DispatcherInterface::class)){ |
|
26 | 26 | $state->setTag('dispatcher', $this->container->get(DispatcherInterface::class)::class); |
27 | 27 | } |
28 | 28 |
@@ -22,7 +22,8 @@ |
||
22 | 22 | { |
23 | 23 | $state->setTag('php', \phpversion()); |
24 | 24 | |
25 | - if ($this->container->has(DispatcherInterface::class)) { |
|
25 | + if ($this->container->has(DispatcherInterface::class)) |
|
26 | + { |
|
26 | 27 | $state->setTag('dispatcher', $this->container->get(DispatcherInterface::class)::class); |
27 | 28 | } |
28 | 29 |
@@ -11,7 +11,7 @@ |
||
11 | 11 | { |
12 | 12 | public function __construct( |
13 | 13 | private FileSnapshot $fileSnapshot, |
14 | - ) { |
|
14 | + ){ |
|
15 | 15 | } |
16 | 16 | |
17 | 17 | public function report(\Throwable $exception): void |
@@ -37,10 +37,10 @@ discard block |
||
37 | 37 | FilesInterface $files, |
38 | 38 | DirectoriesInterface $directories |
39 | 39 | ): int { |
40 | - switch ($this->argument('type')) { |
|
40 | + switch ($this->argument('type')){ |
|
41 | 41 | case 'replace': |
42 | 42 | case 'follow': |
43 | - if ($this->isDirectory()) { |
|
43 | + if ($this->isDirectory()){ |
|
44 | 44 | $this->sprintf( |
45 | 45 | '<fg=cyan>•</fg=cyan> publish directory <comment>%s</comment> to <comment>%s</comment>', |
46 | 46 | $this->getSource($files), |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | $this->getMergeMode(), |
54 | 54 | $this->getFileMode() |
55 | 55 | ); |
56 | - } else { |
|
56 | + }else{ |
|
57 | 57 | $this->sprintf( |
58 | 58 | '<fg=cyan>•</fg=cyan> publish file <comment>%s</comment> to <comment>%s</comment>', |
59 | 59 | $this->getSource($files), |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | |
91 | 91 | private function getSource(FilesInterface $files): ?string |
92 | 92 | { |
93 | - if (!$this->isDirectory()) { |
|
93 | + if (!$this->isDirectory()){ |
|
94 | 94 | return $files->normalizePath($this->argument('source')); |
95 | 95 | } |
96 | 96 | |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | private function getTarget(FilesInterface $files, DirectoriesInterface $directories): ?string |
101 | 101 | { |
102 | 102 | $target = $this->argument('target'); |
103 | - foreach ($directories->getAll() as $alias => $value) { |
|
103 | + foreach ($directories->getAll() as $alias => $value){ |
|
104 | 104 | $target = \str_replace(\sprintf('@%s', $alias), $value, $target); |
105 | 105 | } |
106 | 106 | |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | { |
112 | 112 | return match (true) { |
113 | 113 | $this->argument('type') === 'ensure' => true, |
114 | - \str_contains((string) $this->argument('source'), '*') => true, |
|
114 | + \str_contains((string)$this->argument('source'), '*') => true, |
|
115 | 115 | default => \is_dir($this->argument('source')) |
116 | 116 | }; |
117 | 117 | } |
@@ -37,10 +37,12 @@ discard block |
||
37 | 37 | FilesInterface $files, |
38 | 38 | DirectoriesInterface $directories |
39 | 39 | ): int { |
40 | - switch ($this->argument('type')) { |
|
40 | + switch ($this->argument('type')) |
|
41 | + { |
|
41 | 42 | case 'replace': |
42 | 43 | case 'follow': |
43 | - if ($this->isDirectory()) { |
|
44 | + if ($this->isDirectory()) |
|
45 | + { |
|
44 | 46 | $this->sprintf( |
45 | 47 | '<fg=cyan>•</fg=cyan> publish directory <comment>%s</comment> to <comment>%s</comment>', |
46 | 48 | $this->getSource($files), |
@@ -53,7 +55,9 @@ discard block |
||
53 | 55 | $this->getMergeMode(), |
54 | 56 | $this->getFileMode() |
55 | 57 | ); |
56 | - } else { |
|
58 | + } |
|
59 | + else |
|
60 | + { |
|
57 | 61 | $this->sprintf( |
58 | 62 | '<fg=cyan>•</fg=cyan> publish file <comment>%s</comment> to <comment>%s</comment>', |
59 | 63 | $this->getSource($files), |
@@ -90,7 +94,8 @@ discard block |
||
90 | 94 | |
91 | 95 | private function getSource(FilesInterface $files): ?string |
92 | 96 | { |
93 | - if (!$this->isDirectory()) { |
|
97 | + if (!$this->isDirectory()) |
|
98 | + { |
|
94 | 99 | return $files->normalizePath($this->argument('source')); |
95 | 100 | } |
96 | 101 | |
@@ -100,7 +105,8 @@ discard block |
||
100 | 105 | private function getTarget(FilesInterface $files, DirectoriesInterface $directories): ?string |
101 | 106 | { |
102 | 107 | $target = $this->argument('target'); |
103 | - foreach ($directories->getAll() as $alias => $value) { |
|
108 | + foreach ($directories->getAll() as $alias => $value) |
|
109 | + { |
|
104 | 110 | $target = \str_replace(\sprintf('@%s', $alias), $value, $target); |
105 | 111 | } |
106 | 112 |
@@ -128,7 +128,7 @@ |
||
128 | 128 | private function getFileMode(): int |
129 | 129 | { |
130 | 130 | return match ($this->argument('mode')) { |
131 | - 'readonly' => FilesInterface::READONLY, |
|
131 | + 'readonly' => FilesInterface::readonly, |
|
132 | 132 | 'runtime' => FilesInterface::RUNTIME, |
133 | 133 | default => FilesInterface::RUNTIME, |
134 | 134 | }; |
@@ -18,20 +18,20 @@ discard block |
||
18 | 18 | |
19 | 19 | public function perform(ViewsConfig $config, FilesInterface $files): int |
20 | 20 | { |
21 | - if (!$files->exists($config->getCacheDirectory())) { |
|
21 | + if (!$files->exists($config->getCacheDirectory())){ |
|
22 | 22 | $this->writeln('Cache directory is missing, no cache to be cleaned.'); |
23 | 23 | |
24 | 24 | return self::FAILURE; |
25 | 25 | } |
26 | 26 | |
27 | - if ($this->isVerbose()) { |
|
27 | + if ($this->isVerbose()){ |
|
28 | 28 | $this->writeln('<info>Cleaning view cache:</info>'); |
29 | 29 | } |
30 | 30 | |
31 | - foreach ($files->getFiles($config->getCacheDirectory()) as $filename) { |
|
32 | - try { |
|
31 | + foreach ($files->getFiles($config->getCacheDirectory()) as $filename){ |
|
32 | + try{ |
|
33 | 33 | $files->delete($filename); |
34 | - } catch (\Throwable $e) { |
|
34 | + }catch (\Throwable $e){ |
|
35 | 35 | // @codeCoverageIgnoreStart |
36 | 36 | $this->sprintf( |
37 | 37 | "<fg=red>[errored]</fg=red> `%s`: <fg=red>%s</fg=red>\n", |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | // @codeCoverageIgnoreEnd |
44 | 44 | } |
45 | 45 | |
46 | - if ($this->isVerbose()) { |
|
46 | + if ($this->isVerbose()){ |
|
47 | 47 | $this->sprintf( |
48 | 48 | "<fg=green>[deleted]</fg=green> `%s`\n", |
49 | 49 | $files->relativePath($filename, $config->getCacheDirectory()) |
@@ -18,20 +18,26 @@ discard block |
||
18 | 18 | |
19 | 19 | public function perform(ViewsConfig $config, FilesInterface $files): int |
20 | 20 | { |
21 | - if (!$files->exists($config->getCacheDirectory())) { |
|
21 | + if (!$files->exists($config->getCacheDirectory())) |
|
22 | + { |
|
22 | 23 | $this->writeln('Cache directory is missing, no cache to be cleaned.'); |
23 | 24 | |
24 | 25 | return self::FAILURE; |
25 | 26 | } |
26 | 27 | |
27 | - if ($this->isVerbose()) { |
|
28 | + if ($this->isVerbose()) |
|
29 | + { |
|
28 | 30 | $this->writeln('<info>Cleaning view cache:</info>'); |
29 | 31 | } |
30 | 32 | |
31 | - foreach ($files->getFiles($config->getCacheDirectory()) as $filename) { |
|
32 | - try { |
|
33 | + foreach ($files->getFiles($config->getCacheDirectory()) as $filename) |
|
34 | + { |
|
35 | + try |
|
36 | + { |
|
33 | 37 | $files->delete($filename); |
34 | - } catch (\Throwable $e) { |
|
38 | + } |
|
39 | + catch (\Throwable $e) |
|
40 | + { |
|
35 | 41 | // @codeCoverageIgnoreStart |
36 | 42 | $this->sprintf( |
37 | 43 | "<fg=red>[errored]</fg=red> `%s`: <fg=red>%s</fg=red>\n", |
@@ -43,7 +49,8 @@ discard block |
||
43 | 49 | // @codeCoverageIgnoreEnd |
44 | 50 | } |
45 | 51 | |
46 | - if ($this->isVerbose()) { |
|
52 | + if ($this->isVerbose()) |
|
53 | + { |
|
47 | 54 | $this->sprintf( |
48 | 55 | "<fg=green>[deleted]</fg=green> `%s`\n", |
49 | 56 | $files->relativePath($filename, $config->getCacheDirectory()) |
@@ -25,13 +25,13 @@ discard block |
||
25 | 25 | $generator = new ContextGenerator($views->getContext()); |
26 | 26 | |
27 | 27 | $contexts = $generator->generate(); |
28 | - if (empty($contexts)) { |
|
28 | + if (empty($contexts)){ |
|
29 | 29 | $contexts[] = $views->getContext(); |
30 | 30 | } |
31 | 31 | |
32 | - foreach ($contexts as $context) { |
|
33 | - foreach ($views->getEngines() as $engine) { |
|
34 | - if ($engine instanceof NativeEngine) { |
|
32 | + foreach ($contexts as $context){ |
|
33 | + foreach ($views->getEngines() as $engine){ |
|
34 | + if ($engine instanceof NativeEngine){ |
|
35 | 35 | // no need to compile |
36 | 36 | continue; |
37 | 37 | } |
@@ -53,19 +53,19 @@ discard block |
||
53 | 53 | $this->describeContext($context) ?? 'default' |
54 | 54 | ); |
55 | 55 | |
56 | - foreach ($engine->getLoader()->list() as $path) { |
|
56 | + foreach ($engine->getLoader()->list() as $path){ |
|
57 | 57 | $start = \microtime(true); |
58 | - try { |
|
58 | + try{ |
|
59 | 59 | $engine->reset($path, $context); |
60 | 60 | $engine->compile($path, $context); |
61 | 61 | |
62 | - if ($this->isVerbose()) { |
|
62 | + if ($this->isVerbose()){ |
|
63 | 63 | $this->sprintf('<info>•</info> %s', $path); |
64 | 64 | } |
65 | - } catch (\Throwable $e) { |
|
65 | + }catch (\Throwable $e){ |
|
66 | 66 | $this->renderError($path, $e); |
67 | 67 | continue; |
68 | - } finally { |
|
68 | + }finally{ |
|
69 | 69 | $this->renderElapsed($start); |
70 | 70 | } |
71 | 71 | } |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | |
76 | 76 | protected function renderError(string $path, \Throwable $e): void |
77 | 77 | { |
78 | - if (!$this->isVerbose()) { |
|
78 | + if (!$this->isVerbose()){ |
|
79 | 79 | return; |
80 | 80 | } |
81 | 81 | |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | { |
92 | 92 | $values = []; |
93 | 93 | |
94 | - foreach ($context->getDependencies() as $dependency) { |
|
94 | + foreach ($context->getDependencies() as $dependency){ |
|
95 | 95 | $values[] = \sprintf( |
96 | 96 | '%s%s%s:%s%s%s', |
97 | 97 | Color::LIGHT_WHITE, |
@@ -113,11 +113,11 @@ discard block |
||
113 | 113 | |
114 | 114 | private function renderSuccess(string $lastPath = null): void |
115 | 115 | { |
116 | - if (!$this->isVerbose()) { |
|
116 | + if (!$this->isVerbose()){ |
|
117 | 117 | return; |
118 | 118 | } |
119 | 119 | |
120 | - if ($lastPath === null) { |
|
120 | + if ($lastPath === null){ |
|
121 | 121 | $this->writeln('• no views found'); |
122 | 122 | } |
123 | 123 | |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | |
127 | 127 | private function renderElapsed(float $start): void |
128 | 128 | { |
129 | - if (!$this->isVerbose()) { |
|
129 | + if (!$this->isVerbose()){ |
|
130 | 130 | return; |
131 | 131 | } |
132 | 132 |
@@ -25,13 +25,17 @@ discard block |
||
25 | 25 | $generator = new ContextGenerator($views->getContext()); |
26 | 26 | |
27 | 27 | $contexts = $generator->generate(); |
28 | - if (empty($contexts)) { |
|
28 | + if (empty($contexts)) |
|
29 | + { |
|
29 | 30 | $contexts[] = $views->getContext(); |
30 | 31 | } |
31 | 32 | |
32 | - foreach ($contexts as $context) { |
|
33 | - foreach ($views->getEngines() as $engine) { |
|
34 | - if ($engine instanceof NativeEngine) { |
|
33 | + foreach ($contexts as $context) |
|
34 | + { |
|
35 | + foreach ($views->getEngines() as $engine) |
|
36 | + { |
|
37 | + if ($engine instanceof NativeEngine) |
|
38 | + { |
|
35 | 39 | // no need to compile |
36 | 40 | continue; |
37 | 41 | } |
@@ -53,19 +57,26 @@ discard block |
||
53 | 57 | $this->describeContext($context) ?? 'default' |
54 | 58 | ); |
55 | 59 | |
56 | - foreach ($engine->getLoader()->list() as $path) { |
|
60 | + foreach ($engine->getLoader()->list() as $path) |
|
61 | + { |
|
57 | 62 | $start = \microtime(true); |
58 | - try { |
|
63 | + try |
|
64 | + { |
|
59 | 65 | $engine->reset($path, $context); |
60 | 66 | $engine->compile($path, $context); |
61 | 67 | |
62 | - if ($this->isVerbose()) { |
|
68 | + if ($this->isVerbose()) |
|
69 | + { |
|
63 | 70 | $this->sprintf('<info>•</info> %s', $path); |
64 | 71 | } |
65 | - } catch (\Throwable $e) { |
|
72 | + } |
|
73 | + catch (\Throwable $e) |
|
74 | + { |
|
66 | 75 | $this->renderError($path, $e); |
67 | 76 | continue; |
68 | - } finally { |
|
77 | + } |
|
78 | + finally |
|
79 | + { |
|
69 | 80 | $this->renderElapsed($start); |
70 | 81 | } |
71 | 82 | } |
@@ -75,7 +86,8 @@ discard block |
||
75 | 86 | |
76 | 87 | protected function renderError(string $path, \Throwable $e): void |
77 | 88 | { |
78 | - if (!$this->isVerbose()) { |
|
89 | + if (!$this->isVerbose()) |
|
90 | + { |
|
79 | 91 | return; |
80 | 92 | } |
81 | 93 | |
@@ -91,7 +103,8 @@ discard block |
||
91 | 103 | { |
92 | 104 | $values = []; |
93 | 105 | |
94 | - foreach ($context->getDependencies() as $dependency) { |
|
106 | + foreach ($context->getDependencies() as $dependency) |
|
107 | + { |
|
95 | 108 | $values[] = \sprintf( |
96 | 109 | '%s%s%s:%s%s%s', |
97 | 110 | Color::LIGHT_WHITE, |
@@ -113,11 +126,13 @@ discard block |
||
113 | 126 | |
114 | 127 | private function renderSuccess(string $lastPath = null): void |
115 | 128 | { |
116 | - if (!$this->isVerbose()) { |
|
129 | + if (!$this->isVerbose()) |
|
130 | + { |
|
117 | 131 | return; |
118 | 132 | } |
119 | 133 | |
120 | - if ($lastPath === null) { |
|
134 | + if ($lastPath === null) |
|
135 | + { |
|
121 | 136 | $this->writeln('• no views found'); |
122 | 137 | } |
123 | 138 | |
@@ -126,7 +141,8 @@ discard block |
||
126 | 141 | |
127 | 142 | private function renderElapsed(float $start): void |
128 | 143 | { |
129 | - if (!$this->isVerbose()) { |
|
144 | + if (!$this->isVerbose()) |
|
145 | + { |
|
130 | 146 | return; |
131 | 147 | } |
132 | 148 |
@@ -21,14 +21,14 @@ discard block |
||
21 | 21 | ['locale', InputArgument::REQUIRED, 'Locale to be dumped'], |
22 | 22 | ['path', InputArgument::REQUIRED, 'Export path'], |
23 | 23 | ]; |
24 | - protected const OPTIONS = [ |
|
24 | + protected const OPTIONS = [ |
|
25 | 25 | ['dumper', 'd', InputOption::VALUE_OPTIONAL, 'Dumper name', 'php'], |
26 | 26 | ['fallback', 'f', InputOption::VALUE_NONE, 'Merge messages from fallback catalogue'], |
27 | 27 | ]; |
28 | 28 | |
29 | 29 | public function perform(TranslatorConfig $config, CatalogueManager $manager): int |
30 | 30 | { |
31 | - if (!$config->hasDumper($this->option('dumper'))) { |
|
31 | + if (!$config->hasDumper($this->option('dumper'))){ |
|
32 | 32 | $this->writeln("<fg=red>Undefined dumper '{$this->option('dumper')}'.</fg=red>"); |
33 | 33 | |
34 | 34 | return self::FAILURE; |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | $manager->get($this->argument('locale')) |
41 | 41 | ); |
42 | 42 | |
43 | - if ($this->isVerbose() && !empty($mc->getDomains())) { |
|
43 | + if ($this->isVerbose() && !empty($mc->getDomains())){ |
|
44 | 44 | $this->sprintf( |
45 | 45 | "<info>Exporting domain(s):</info> %s\n", |
46 | 46 | \implode(',', $mc->getDomains()) |
@@ -58,8 +58,8 @@ discard block |
||
58 | 58 | ] |
59 | 59 | ); |
60 | 60 | |
61 | - $this->writeln('Export successfully completed using <info>' . $dumper::class . '</info>'); |
|
62 | - $this->writeln('Output: <comment>' . \realpath($this->argument('path')) . '</comment>'); |
|
61 | + $this->writeln('Export successfully completed using <info>'.$dumper::class.'</info>'); |
|
62 | + $this->writeln('Output: <comment>'.\realpath($this->argument('path')).'</comment>'); |
|
63 | 63 | |
64 | 64 | return self::SUCCESS; |
65 | 65 | } |
@@ -74,10 +74,10 @@ discard block |
||
74 | 74 | $catalogue->getData() |
75 | 75 | ); |
76 | 76 | |
77 | - if ($this->option('fallback')) { |
|
78 | - foreach ($manager->get($config->getFallbackLocale())->getData() as $domain => $messages) { |
|
79 | - foreach ($messages as $id => $message) { |
|
80 | - if (!$messageCatalogue->defines($id, $domain)) { |
|
77 | + if ($this->option('fallback')){ |
|
78 | + foreach ($manager->get($config->getFallbackLocale())->getData() as $domain => $messages){ |
|
79 | + foreach ($messages as $id => $message){ |
|
80 | + if (!$messageCatalogue->defines($id, $domain)){ |
|
81 | 81 | $messageCatalogue->set($id, $message, $domain); |
82 | 82 | } |
83 | 83 | } |
@@ -28,7 +28,8 @@ discard block |
||
28 | 28 | |
29 | 29 | public function perform(TranslatorConfig $config, CatalogueManager $manager): int |
30 | 30 | { |
31 | - if (!$config->hasDumper($this->option('dumper'))) { |
|
31 | + if (!$config->hasDumper($this->option('dumper'))) |
|
32 | + { |
|
32 | 33 | $this->writeln("<fg=red>Undefined dumper '{$this->option('dumper')}'.</fg=red>"); |
33 | 34 | |
34 | 35 | return self::FAILURE; |
@@ -40,7 +41,8 @@ discard block |
||
40 | 41 | $manager->get($this->argument('locale')) |
41 | 42 | ); |
42 | 43 | |
43 | - if ($this->isVerbose() && !empty($mc->getDomains())) { |
|
44 | + if ($this->isVerbose() && !empty($mc->getDomains())) |
|
45 | + { |
|
44 | 46 | $this->sprintf( |
45 | 47 | "<info>Exporting domain(s):</info> %s\n", |
46 | 48 | \implode(',', $mc->getDomains()) |
@@ -74,10 +76,14 @@ discard block |
||
74 | 76 | $catalogue->getData() |
75 | 77 | ); |
76 | 78 | |
77 | - if ($this->option('fallback')) { |
|
78 | - foreach ($manager->get($config->getFallbackLocale())->getData() as $domain => $messages) { |
|
79 | - foreach ($messages as $id => $message) { |
|
80 | - if (!$messageCatalogue->defines($id, $domain)) { |
|
79 | + if ($this->option('fallback')) |
|
80 | + { |
|
81 | + foreach ($manager->get($config->getFallbackLocale())->getData() as $domain => $messages) |
|
82 | + { |
|
83 | + foreach ($messages as $id => $message) |
|
84 | + { |
|
85 | + if (!$messageCatalogue->defines($id, $domain)) |
|
86 | + { |
|
81 | 87 | $messageCatalogue->set($id, $message, $domain); |
82 | 88 | } |
83 | 89 | } |
@@ -17,20 +17,20 @@ discard block |
||
17 | 17 | public function perform(FilesInterface $files, DirectoriesInterface $directories): int |
18 | 18 | { |
19 | 19 | $cacheDirectory = $directories->get('cache'); |
20 | - if (!$files->exists($cacheDirectory)) { |
|
20 | + if (!$files->exists($cacheDirectory)){ |
|
21 | 21 | $this->writeln('Cache directory is missing, no cache to be cleaned.'); |
22 | 22 | |
23 | 23 | return self::FAILURE; |
24 | 24 | } |
25 | 25 | |
26 | - if ($this->isVerbose()) { |
|
26 | + if ($this->isVerbose()){ |
|
27 | 27 | $this->writeln('<info>Cleaning application cache:</info>'); |
28 | 28 | } |
29 | 29 | |
30 | - foreach ($files->getFiles($cacheDirectory) as $filename) { |
|
31 | - try { |
|
30 | + foreach ($files->getFiles($cacheDirectory) as $filename){ |
|
31 | + try{ |
|
32 | 32 | $files->delete($filename); |
33 | - } catch (\Throwable $e) { |
|
33 | + }catch (\Throwable $e){ |
|
34 | 34 | // @codeCoverageIgnoreStart |
35 | 35 | $this->sprintf( |
36 | 36 | "<fg=red>[errored]</fg=red> `%s`: <fg=red>%s</fg=red>\n", |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | // @codeCoverageIgnoreEnd |
43 | 43 | } |
44 | 44 | |
45 | - if ($this->isVerbose()) { |
|
45 | + if ($this->isVerbose()){ |
|
46 | 46 | $this->sprintf( |
47 | 47 | "<fg=green>[deleted]</fg=green> `%s`\n", |
48 | 48 | $files->relativePath($filename, $cacheDirectory) |
@@ -17,20 +17,26 @@ discard block |
||
17 | 17 | public function perform(FilesInterface $files, DirectoriesInterface $directories): int |
18 | 18 | { |
19 | 19 | $cacheDirectory = $directories->get('cache'); |
20 | - if (!$files->exists($cacheDirectory)) { |
|
20 | + if (!$files->exists($cacheDirectory)) |
|
21 | + { |
|
21 | 22 | $this->writeln('Cache directory is missing, no cache to be cleaned.'); |
22 | 23 | |
23 | 24 | return self::FAILURE; |
24 | 25 | } |
25 | 26 | |
26 | - if ($this->isVerbose()) { |
|
27 | + if ($this->isVerbose()) |
|
28 | + { |
|
27 | 29 | $this->writeln('<info>Cleaning application cache:</info>'); |
28 | 30 | } |
29 | 31 | |
30 | - foreach ($files->getFiles($cacheDirectory) as $filename) { |
|
31 | - try { |
|
32 | + foreach ($files->getFiles($cacheDirectory) as $filename) |
|
33 | + { |
|
34 | + try |
|
35 | + { |
|
32 | 36 | $files->delete($filename); |
33 | - } catch (\Throwable $e) { |
|
37 | + } |
|
38 | + catch (\Throwable $e) |
|
39 | + { |
|
34 | 40 | // @codeCoverageIgnoreStart |
35 | 41 | $this->sprintf( |
36 | 42 | "<fg=red>[errored]</fg=red> `%s`: <fg=red>%s</fg=red>\n", |
@@ -42,7 +48,8 @@ discard block |
||
42 | 48 | // @codeCoverageIgnoreEnd |
43 | 49 | } |
44 | 50 | |
45 | - if ($this->isVerbose()) { |
|
51 | + if ($this->isVerbose()) |
|
52 | + { |
|
46 | 53 | $this->sprintf( |
47 | 54 | "<fg=green>[deleted]</fg=green> `%s`\n", |
48 | 55 | $files->relativePath($filename, $cacheDirectory) |