@@ -24,14 +24,14 @@ discard block |
||
24 | 24 | */ |
25 | 25 | public function perform(): void |
26 | 26 | { |
27 | - if (!$this->verifyConfigured() || !$this->verifyEnvironment()) { |
|
27 | + if (!$this->verifyConfigured() || !$this->verifyEnvironment()){ |
|
28 | 28 | //Making sure we can safely migrate in this environment |
29 | 29 | return; |
30 | 30 | } |
31 | 31 | |
32 | 32 | $found = false; |
33 | 33 | $count = !$this->option('all') ? 1 : PHP_INT_MAX; |
34 | - while ($count > 0 && ($migration = $this->migrator->rollback())) { |
|
34 | + while ($count > 0 && ($migration = $this->migrator->rollback())){ |
|
35 | 35 | $found = true; |
36 | 36 | $count--; |
37 | 37 | $this->sprintf( |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | ); |
41 | 41 | } |
42 | 42 | |
43 | - if (!$found) { |
|
43 | + if (!$found){ |
|
44 | 44 | $this->writeln('<fg=red>No executed migrations were found.</fg=red>'); |
45 | 45 | } |
46 | 46 | } |
@@ -24,14 +24,16 @@ discard block |
||
24 | 24 | */ |
25 | 25 | public function perform(): void |
26 | 26 | { |
27 | - if (!$this->verifyConfigured() || !$this->verifyEnvironment()) { |
|
27 | + if (!$this->verifyConfigured() || !$this->verifyEnvironment()) |
|
28 | + { |
|
28 | 29 | //Making sure we can safely migrate in this environment |
29 | 30 | return; |
30 | 31 | } |
31 | 32 | |
32 | 33 | $found = false; |
33 | 34 | $count = !$this->option('all') ? 1 : PHP_INT_MAX; |
34 | - while ($count > 0 && ($migration = $this->migrator->rollback())) { |
|
35 | + while ($count > 0 && ($migration = $this->migrator->rollback())) |
|
36 | + { |
|
35 | 37 | $found = true; |
36 | 38 | $count--; |
37 | 39 | $this->sprintf( |
@@ -40,7 +42,8 @@ discard block |
||
40 | 42 | ); |
41 | 43 | } |
42 | 44 | |
43 | - if (!$found) { |
|
45 | + if (!$found) |
|
46 | + { |
|
44 | 47 | $this->writeln('<fg=red>No executed migrations were found.</fg=red>'); |
45 | 48 | } |
46 | 49 | } |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function perform(Console $console): void |
29 | 29 | { |
30 | - if (!$this->verifyEnvironment()) { |
|
30 | + if (!$this->verifyEnvironment()){ |
|
31 | 31 | //Making sure we can safely migrate in this environment |
32 | 32 | return; |
33 | 33 | } |
@@ -35,9 +35,9 @@ discard block |
||
35 | 35 | $rollback = ['--force' => true]; |
36 | 36 | $migrate = ['--force' => true]; |
37 | 37 | |
38 | - if ($this->option('all')) { |
|
38 | + if ($this->option('all')){ |
|
39 | 39 | $rollback['--all'] = true; |
40 | - } else { |
|
40 | + }else{ |
|
41 | 41 | $migrate['--one'] = true; |
42 | 42 | } |
43 | 43 |
@@ -27,7 +27,8 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function perform(Console $console): void |
29 | 29 | { |
30 | - if (!$this->verifyEnvironment()) { |
|
30 | + if (!$this->verifyEnvironment()) |
|
31 | + { |
|
31 | 32 | //Making sure we can safely migrate in this environment |
32 | 33 | return; |
33 | 34 | } |
@@ -35,9 +36,12 @@ discard block |
||
35 | 36 | $rollback = ['--force' => true]; |
36 | 37 | $migrate = ['--force' => true]; |
37 | 38 | |
38 | - if ($this->option('all')) { |
|
39 | + if ($this->option('all')) |
|
40 | + { |
|
39 | 41 | $rollback['--all'] = true; |
40 | - } else { |
|
42 | + } |
|
43 | + else |
|
44 | + { |
|
41 | 45 | $migrate['--one'] = true; |
42 | 46 | } |
43 | 47 |
@@ -24,14 +24,14 @@ discard block |
||
24 | 24 | */ |
25 | 25 | public function perform(): void |
26 | 26 | { |
27 | - if (!$this->verifyConfigured() || !$this->verifyEnvironment()) { |
|
27 | + if (!$this->verifyConfigured() || !$this->verifyEnvironment()){ |
|
28 | 28 | return; |
29 | 29 | } |
30 | 30 | |
31 | 31 | $found = false; |
32 | 32 | $count = $this->option('one') ? 1 : PHP_INT_MAX; |
33 | 33 | |
34 | - while ($count > 0 && ($migration = $this->migrator->run())) { |
|
34 | + while ($count > 0 && ($migration = $this->migrator->run())){ |
|
35 | 35 | $found = true; |
36 | 36 | $count--; |
37 | 37 | |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | ); |
42 | 42 | } |
43 | 43 | |
44 | - if (!$found) { |
|
44 | + if (!$found){ |
|
45 | 45 | $this->writeln('<fg=red>No outstanding migrations were found.</fg=red>'); |
46 | 46 | } |
47 | 47 | } |
@@ -24,14 +24,16 @@ discard block |
||
24 | 24 | */ |
25 | 25 | public function perform(): void |
26 | 26 | { |
27 | - if (!$this->verifyConfigured() || !$this->verifyEnvironment()) { |
|
27 | + if (!$this->verifyConfigured() || !$this->verifyEnvironment()) |
|
28 | + { |
|
28 | 29 | return; |
29 | 30 | } |
30 | 31 | |
31 | 32 | $found = false; |
32 | 33 | $count = $this->option('one') ? 1 : PHP_INT_MAX; |
33 | 34 | |
34 | - while ($count > 0 && ($migration = $this->migrator->run())) { |
|
35 | + while ($count > 0 && ($migration = $this->migrator->run())) |
|
36 | + { |
|
35 | 37 | $found = true; |
36 | 38 | $count--; |
37 | 39 | |
@@ -41,7 +43,8 @@ discard block |
||
41 | 43 | ); |
42 | 44 | } |
43 | 45 | |
44 | - if (!$found) { |
|
46 | + if (!$found) |
|
47 | + { |
|
45 | 48 | $this->writeln('<fg=red>No outstanding migrations were found.</fg=red>'); |
46 | 49 | } |
47 | 50 | } |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | */ |
42 | 42 | protected function verifyConfigured(): bool |
43 | 43 | { |
44 | - if (!$this->migrator->isConfigured()) { |
|
44 | + if (!$this->migrator->isConfigured()){ |
|
45 | 45 | $this->writeln( |
46 | 46 | "<fg=red>Migrations are not configured yet, run '<info>migrate:init</info>' first.</fg=red>" |
47 | 47 | ); |
@@ -59,14 +59,14 @@ discard block |
||
59 | 59 | */ |
60 | 60 | protected function verifyEnvironment(): bool |
61 | 61 | { |
62 | - if ($this->option('force') || $this->config->isSafe()) { |
|
62 | + if ($this->option('force') || $this->config->isSafe()){ |
|
63 | 63 | //Safe to run |
64 | 64 | return true; |
65 | 65 | } |
66 | 66 | |
67 | 67 | $this->writeln('<fg=red>Confirmation is required to run migrations!</fg=red>'); |
68 | 68 | |
69 | - if (!$this->askConfirmation()) { |
|
69 | + if (!$this->askConfirmation()){ |
|
70 | 70 | $this->writeln('<comment>Cancelling operation...</comment>'); |
71 | 71 | |
72 | 72 | return false; |
@@ -41,7 +41,8 @@ discard block |
||
41 | 41 | */ |
42 | 42 | protected function verifyConfigured(): bool |
43 | 43 | { |
44 | - if (!$this->migrator->isConfigured()) { |
|
44 | + if (!$this->migrator->isConfigured()) |
|
45 | + { |
|
45 | 46 | $this->writeln( |
46 | 47 | "<fg=red>Migrations are not configured yet, run '<info>migrate:init</info>' first.</fg=red>" |
47 | 48 | ); |
@@ -59,14 +60,16 @@ discard block |
||
59 | 60 | */ |
60 | 61 | protected function verifyEnvironment(): bool |
61 | 62 | { |
62 | - if ($this->option('force') || $this->config->isSafe()) { |
|
63 | + if ($this->option('force') || $this->config->isSafe()) |
|
64 | + { |
|
63 | 65 | //Safe to run |
64 | 66 | return true; |
65 | 67 | } |
66 | 68 | |
67 | 69 | $this->writeln('<fg=red>Confirmation is required to run migrations!</fg=red>'); |
68 | 70 | |
69 | - if (!$this->askConfirmation()) { |
|
71 | + if (!$this->askConfirmation()) |
|
72 | + { |
|
70 | 73 | $this->writeln('<comment>Cancelling operation...</comment>'); |
71 | 74 | |
72 | 75 | return false; |
@@ -34,13 +34,13 @@ discard block |
||
34 | 34 | $generator = new ContextGenerator($views->getContext()); |
35 | 35 | |
36 | 36 | $contexts = $generator->generate(); |
37 | - if (empty($contexts)) { |
|
37 | + if (empty($contexts)){ |
|
38 | 38 | $contexts[] = $views->getContext(); |
39 | 39 | } |
40 | 40 | |
41 | - foreach ($contexts as $context) { |
|
42 | - foreach ($views->getEngines() as $engine) { |
|
43 | - if ($engine instanceof NativeEngine) { |
|
41 | + foreach ($contexts as $context){ |
|
42 | + foreach ($views->getEngines() as $engine){ |
|
43 | + if ($engine instanceof NativeEngine){ |
|
44 | 44 | // no need to compile |
45 | 45 | continue; |
46 | 46 | } |
@@ -64,19 +64,19 @@ discard block |
||
64 | 64 | $this->describeContext($context) ?? 'default' |
65 | 65 | ); |
66 | 66 | |
67 | - foreach ($engine->getLoader()->list() as $path) { |
|
67 | + foreach ($engine->getLoader()->list() as $path){ |
|
68 | 68 | $start = microtime(true); |
69 | - try { |
|
69 | + try{ |
|
70 | 70 | $engine->reset($path, $context); |
71 | 71 | $engine->compile($path, $context); |
72 | 72 | |
73 | - if ($this->isVerbose()) { |
|
73 | + if ($this->isVerbose()){ |
|
74 | 74 | $this->sprintf('<info>•</info> %s', $path); |
75 | 75 | } |
76 | - } catch (\Throwable $e) { |
|
76 | + }catch (\Throwable $e){ |
|
77 | 77 | $this->renderError($path, $e); |
78 | 78 | continue; |
79 | - } finally { |
|
79 | + }finally{ |
|
80 | 80 | $this->renderElapsed($start); |
81 | 81 | } |
82 | 82 | } |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | */ |
91 | 91 | protected function renderError(string $path, \Throwable $e): void |
92 | 92 | { |
93 | - if (!$this->isVerbose()) { |
|
93 | + if (!$this->isVerbose()){ |
|
94 | 94 | return; |
95 | 95 | } |
96 | 96 | |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | { |
111 | 111 | $values = []; |
112 | 112 | |
113 | - foreach ($context->getDependencies() as $dependency) { |
|
113 | + foreach ($context->getDependencies() as $dependency){ |
|
114 | 114 | $values[] = sprintf( |
115 | 115 | '%s%s%s:%s%s%s', |
116 | 116 | Color::LIGHT_WHITE, |
@@ -141,11 +141,11 @@ discard block |
||
141 | 141 | */ |
142 | 142 | private function renderSuccess(string $lastPath = null): void |
143 | 143 | { |
144 | - if (!$this->isVerbose()) { |
|
144 | + if (!$this->isVerbose()){ |
|
145 | 145 | return; |
146 | 146 | } |
147 | 147 | |
148 | - if ($lastPath === null) { |
|
148 | + if ($lastPath === null){ |
|
149 | 149 | $this->writeln('• no views found'); |
150 | 150 | } |
151 | 151 | |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | */ |
158 | 158 | private function renderElapsed(float $start): void |
159 | 159 | { |
160 | - if (!$this->isVerbose()) { |
|
160 | + if (!$this->isVerbose()){ |
|
161 | 161 | return; |
162 | 162 | } |
163 | 163 |
@@ -34,13 +34,17 @@ discard block |
||
34 | 34 | $generator = new ContextGenerator($views->getContext()); |
35 | 35 | |
36 | 36 | $contexts = $generator->generate(); |
37 | - if (empty($contexts)) { |
|
37 | + if (empty($contexts)) |
|
38 | + { |
|
38 | 39 | $contexts[] = $views->getContext(); |
39 | 40 | } |
40 | 41 | |
41 | - foreach ($contexts as $context) { |
|
42 | - foreach ($views->getEngines() as $engine) { |
|
43 | - if ($engine instanceof NativeEngine) { |
|
42 | + foreach ($contexts as $context) |
|
43 | + { |
|
44 | + foreach ($views->getEngines() as $engine) |
|
45 | + { |
|
46 | + if ($engine instanceof NativeEngine) |
|
47 | + { |
|
44 | 48 | // no need to compile |
45 | 49 | continue; |
46 | 50 | } |
@@ -64,19 +68,26 @@ discard block |
||
64 | 68 | $this->describeContext($context) ?? 'default' |
65 | 69 | ); |
66 | 70 | |
67 | - foreach ($engine->getLoader()->list() as $path) { |
|
71 | + foreach ($engine->getLoader()->list() as $path) |
|
72 | + { |
|
68 | 73 | $start = microtime(true); |
69 | - try { |
|
74 | + try |
|
75 | + { |
|
70 | 76 | $engine->reset($path, $context); |
71 | 77 | $engine->compile($path, $context); |
72 | 78 | |
73 | - if ($this->isVerbose()) { |
|
79 | + if ($this->isVerbose()) |
|
80 | + { |
|
74 | 81 | $this->sprintf('<info>•</info> %s', $path); |
75 | 82 | } |
76 | - } catch (\Throwable $e) { |
|
83 | + } |
|
84 | + catch (\Throwable $e) |
|
85 | + { |
|
77 | 86 | $this->renderError($path, $e); |
78 | 87 | continue; |
79 | - } finally { |
|
88 | + } |
|
89 | + finally |
|
90 | + { |
|
80 | 91 | $this->renderElapsed($start); |
81 | 92 | } |
82 | 93 | } |
@@ -90,7 +101,8 @@ discard block |
||
90 | 101 | */ |
91 | 102 | protected function renderError(string $path, \Throwable $e): void |
92 | 103 | { |
93 | - if (!$this->isVerbose()) { |
|
104 | + if (!$this->isVerbose()) |
|
105 | + { |
|
94 | 106 | return; |
95 | 107 | } |
96 | 108 | |
@@ -110,7 +122,8 @@ discard block |
||
110 | 122 | { |
111 | 123 | $values = []; |
112 | 124 | |
113 | - foreach ($context->getDependencies() as $dependency) { |
|
125 | + foreach ($context->getDependencies() as $dependency) |
|
126 | + { |
|
114 | 127 | $values[] = sprintf( |
115 | 128 | '%s%s%s:%s%s%s', |
116 | 129 | Color::LIGHT_WHITE, |
@@ -141,11 +154,13 @@ discard block |
||
141 | 154 | */ |
142 | 155 | private function renderSuccess(string $lastPath = null): void |
143 | 156 | { |
144 | - if (!$this->isVerbose()) { |
|
157 | + if (!$this->isVerbose()) |
|
158 | + { |
|
145 | 159 | return; |
146 | 160 | } |
147 | 161 | |
148 | - if ($lastPath === null) { |
|
162 | + if ($lastPath === null) |
|
163 | + { |
|
149 | 164 | $this->writeln('• no views found'); |
150 | 165 | } |
151 | 166 | |
@@ -157,7 +172,8 @@ discard block |
||
157 | 172 | */ |
158 | 173 | private function renderElapsed(float $start): void |
159 | 174 | { |
160 | - if (!$this->isVerbose()) { |
|
175 | + if (!$this->isVerbose()) |
|
176 | + { |
|
161 | 177 | return; |
162 | 178 | } |
163 | 179 |
@@ -27,20 +27,20 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function perform(ViewsConfig $config, FilesInterface $files): void |
29 | 29 | { |
30 | - if (!$files->exists($config->getCacheDirectory())) { |
|
30 | + if (!$files->exists($config->getCacheDirectory())){ |
|
31 | 31 | $this->writeln('Cache directory is missing, no cache to be cleaned.'); |
32 | 32 | |
33 | 33 | return; |
34 | 34 | } |
35 | 35 | |
36 | - if ($this->isVerbose()) { |
|
36 | + if ($this->isVerbose()){ |
|
37 | 37 | $this->writeln('<info>Cleaning view cache:</info>'); |
38 | 38 | } |
39 | 39 | |
40 | - foreach ($files->getFiles($config->getCacheDirectory()) as $filename) { |
|
41 | - try { |
|
40 | + foreach ($files->getFiles($config->getCacheDirectory()) as $filename){ |
|
41 | + try{ |
|
42 | 42 | $files->delete($filename); |
43 | - } catch (\Throwable $e) { |
|
43 | + }catch (\Throwable $e){ |
|
44 | 44 | // @codeCoverageIgnoreStart |
45 | 45 | $this->sprintf( |
46 | 46 | "<fg=red>[errored]</fg=red> `%s`: <fg=red>%s</fg=red>\n", |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | // @codeCoverageIgnoreEnd |
54 | 54 | } |
55 | 55 | |
56 | - if ($this->isVerbose()) { |
|
56 | + if ($this->isVerbose()){ |
|
57 | 57 | $this->sprintf( |
58 | 58 | "<fg=green>[deleted]</fg=green> `%s`\n", |
59 | 59 | $files->relativePath($filename, $config->getCacheDirectory()) |
@@ -27,20 +27,26 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function perform(ViewsConfig $config, FilesInterface $files): void |
29 | 29 | { |
30 | - if (!$files->exists($config->getCacheDirectory())) { |
|
30 | + if (!$files->exists($config->getCacheDirectory())) |
|
31 | + { |
|
31 | 32 | $this->writeln('Cache directory is missing, no cache to be cleaned.'); |
32 | 33 | |
33 | 34 | return; |
34 | 35 | } |
35 | 36 | |
36 | - if ($this->isVerbose()) { |
|
37 | + if ($this->isVerbose()) |
|
38 | + { |
|
37 | 39 | $this->writeln('<info>Cleaning view cache:</info>'); |
38 | 40 | } |
39 | 41 | |
40 | - foreach ($files->getFiles($config->getCacheDirectory()) as $filename) { |
|
41 | - try { |
|
42 | + foreach ($files->getFiles($config->getCacheDirectory()) as $filename) |
|
43 | + { |
|
44 | + try |
|
45 | + { |
|
42 | 46 | $files->delete($filename); |
43 | - } catch (\Throwable $e) { |
|
47 | + } |
|
48 | + catch (\Throwable $e) |
|
49 | + { |
|
44 | 50 | // @codeCoverageIgnoreStart |
45 | 51 | $this->sprintf( |
46 | 52 | "<fg=red>[errored]</fg=red> `%s`: <fg=red>%s</fg=red>\n", |
@@ -53,7 +59,8 @@ discard block |
||
53 | 59 | // @codeCoverageIgnoreEnd |
54 | 60 | } |
55 | 61 | |
56 | - if ($this->isVerbose()) { |
|
62 | + if ($this->isVerbose()) |
|
63 | + { |
|
57 | 64 | $this->sprintf( |
58 | 65 | "<fg=green>[deleted]</fg=green> `%s`\n", |
59 | 66 | $files->relativePath($filename, $config->getCacheDirectory()) |
@@ -42,8 +42,10 @@ discard block |
||
42 | 42 | { |
43 | 43 | $grid = $this->table(['Name:', 'Verbs:', 'Pattern:', 'Target:']); |
44 | 44 | |
45 | - foreach ($router->getRoutes() as $name => $route) { |
|
46 | - if ($route instanceof Route) { |
|
45 | + foreach ($router->getRoutes() as $name => $route) |
|
46 | + { |
|
47 | + if ($route instanceof Route) |
|
48 | + { |
|
47 | 49 | $grid->addRow( |
48 | 50 | [ |
49 | 51 | $name, |
@@ -64,14 +66,17 @@ discard block |
||
64 | 66 | */ |
65 | 67 | private function getVerbs(Route $route): string |
66 | 68 | { |
67 | - if ($route->getVerbs() === Route::VERBS) { |
|
69 | + if ($route->getVerbs() === Route::VERBS) |
|
70 | + { |
|
68 | 71 | return '*'; |
69 | 72 | } |
70 | 73 | |
71 | 74 | $result = []; |
72 | 75 | |
73 | - foreach ($route->getVerbs() as $verb) { |
|
74 | - switch (strtolower($verb)) { |
|
76 | + foreach ($route->getVerbs() as $verb) |
|
77 | + { |
|
78 | + switch (strtolower($verb)) |
|
79 | + { |
|
75 | 80 | case 'get': |
76 | 81 | $verb = '<fg=green>GET</>'; |
77 | 82 | break; |
@@ -107,7 +112,8 @@ discard block |
||
107 | 112 | |
108 | 113 | return preg_replace_callback( |
109 | 114 | '/<([^>]*)>/', |
110 | - static function ($m) { |
|
115 | + static function ($m) |
|
116 | + { |
|
111 | 117 | return sprintf('<fg=magenta>%s</>', $m[0]); |
112 | 118 | }, |
113 | 119 | $pattern |
@@ -124,7 +130,8 @@ discard block |
||
124 | 130 | private function getTarget(Route $route, KernelInterface $kernel): string |
125 | 131 | { |
126 | 132 | $target = $this->getValue($route, 'target'); |
127 | - switch (true) { |
|
133 | + switch (true) |
|
134 | + { |
|
128 | 135 | case $target instanceof Closure: |
129 | 136 | $reflection = new ReflectionFunction($target); |
130 | 137 | return sprintf( |
@@ -148,7 +155,8 @@ discard block |
||
148 | 155 | |
149 | 156 | case $target instanceof Group: |
150 | 157 | $result = []; |
151 | - foreach ($this->getValue($target, 'controllers') as $alias => $class) { |
|
158 | + foreach ($this->getValue($target, 'controllers') as $alias => $class) |
|
159 | + { |
|
152 | 160 | $result[] = sprintf('%s => %s', $alias, $this->relativeClass($class, $kernel)); |
153 | 161 | } |
154 | 162 | |
@@ -174,11 +182,14 @@ discard block |
||
174 | 182 | */ |
175 | 183 | private function getValue(object $object, string $property) |
176 | 184 | { |
177 | - try { |
|
185 | + try |
|
186 | + { |
|
178 | 187 | $r = new ReflectionObject($object); |
179 | 188 | $prop = $r->getProperty($property); |
180 | 189 | $prop->setAccessible(true); |
181 | - } catch (Throwable $e) { |
|
190 | + } |
|
191 | + catch (Throwable $e) |
|
192 | + { |
|
182 | 193 | return $e->getMessage(); |
183 | 194 | } |
184 | 195 | |
@@ -195,7 +206,8 @@ discard block |
||
195 | 206 | $r = new ReflectionObject($kernel); |
196 | 207 | $r->getNamespaceName(); |
197 | 208 | |
198 | - if (strpos($class, $r->getNamespaceName()) === 0) { |
|
209 | + if (strpos($class, $r->getNamespaceName()) === 0) |
|
210 | + { |
|
199 | 211 | return substr($class, strlen($r->getNamespaceName()) + 1); |
200 | 212 | } |
201 | 213 |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | { |
43 | 43 | $grid = $this->table(['Name:', 'Verbs:', 'Pattern:', 'Target:']); |
44 | 44 | |
45 | - foreach ($router->getRoutes() as $name => $route) { |
|
46 | - if ($route instanceof Route) { |
|
45 | + foreach ($router->getRoutes() as $name => $route){ |
|
46 | + if ($route instanceof Route){ |
|
47 | 47 | $grid->addRow( |
48 | 48 | [ |
49 | 49 | $name, |
@@ -64,14 +64,14 @@ discard block |
||
64 | 64 | */ |
65 | 65 | private function getVerbs(Route $route): string |
66 | 66 | { |
67 | - if ($route->getVerbs() === Route::VERBS) { |
|
67 | + if ($route->getVerbs() === Route::VERBS){ |
|
68 | 68 | return '*'; |
69 | 69 | } |
70 | 70 | |
71 | 71 | $result = []; |
72 | 72 | |
73 | - foreach ($route->getVerbs() as $verb) { |
|
74 | - switch (strtolower($verb)) { |
|
73 | + foreach ($route->getVerbs() as $verb){ |
|
74 | + switch (strtolower($verb)){ |
|
75 | 75 | case 'get': |
76 | 76 | $verb = '<fg=green>GET</>'; |
77 | 77 | break; |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | |
108 | 108 | return preg_replace_callback( |
109 | 109 | '/<([^>]*)>/', |
110 | - static function ($m) { |
|
110 | + static function ($m){ |
|
111 | 111 | return sprintf('<fg=magenta>%s</>', $m[0]); |
112 | 112 | }, |
113 | 113 | $pattern |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | private function getTarget(Route $route, KernelInterface $kernel): string |
125 | 125 | { |
126 | 126 | $target = $this->getValue($route, 'target'); |
127 | - switch (true) { |
|
127 | + switch (true){ |
|
128 | 128 | case $target instanceof Closure: |
129 | 129 | $reflection = new ReflectionFunction($target); |
130 | 130 | return sprintf( |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | return sprintf( |
138 | 138 | '%s->%s', |
139 | 139 | $this->relativeClass($this->getValue($target, 'controller'), $kernel), |
140 | - implode('|', (array) $this->getValue($target, 'action')) |
|
140 | + implode('|', (array)$this->getValue($target, 'action')) |
|
141 | 141 | ); |
142 | 142 | |
143 | 143 | case $target instanceof Controller: |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | |
149 | 149 | case $target instanceof Group: |
150 | 150 | $result = []; |
151 | - foreach ($this->getValue($target, 'controllers') as $alias => $class) { |
|
151 | + foreach ($this->getValue($target, 'controllers') as $alias => $class){ |
|
152 | 152 | $result[] = sprintf('%s => %s', $alias, $this->relativeClass($class, $kernel)); |
153 | 153 | } |
154 | 154 | |
@@ -172,11 +172,11 @@ discard block |
||
172 | 172 | */ |
173 | 173 | private function getValue(object $object, string $property) |
174 | 174 | { |
175 | - try { |
|
175 | + try{ |
|
176 | 176 | $r = new ReflectionObject($object); |
177 | 177 | $prop = $r->getProperty($property); |
178 | 178 | $prop->setAccessible(true); |
179 | - } catch (Throwable $e) { |
|
179 | + }catch (Throwable $e){ |
|
180 | 180 | return $e->getMessage(); |
181 | 181 | } |
182 | 182 | |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | $r = new ReflectionObject($kernel); |
194 | 194 | $r->getNamespaceName(); |
195 | 195 | |
196 | - if (strpos($class, $r->getNamespaceName()) === 0) { |
|
196 | + if (strpos($class, $r->getNamespaceName()) === 0){ |
|
197 | 197 | return substr($class, strlen($r->getNamespaceName()) + 1); |
198 | 198 | } |
199 | 199 |
@@ -55,21 +55,21 @@ |
||
55 | 55 | $this->sprintf("<info>New encryption key:</info> <fg=cyan>%s</fg=cyan>\n", $key); |
56 | 56 | |
57 | 57 | $file = $this->option('mount'); |
58 | - if ($file === null) { |
|
58 | + if ($file === null){ |
|
59 | 59 | return; |
60 | 60 | } |
61 | 61 | |
62 | - if (!$files->exists($file)) { |
|
62 | + if (!$files->exists($file)){ |
|
63 | 63 | $this->sprintf('<error>Unable to find `%s`</error>', $file); |
64 | 64 | return; |
65 | 65 | } |
66 | 66 | |
67 | 67 | $content = $files->read($file); |
68 | 68 | |
69 | - try { |
|
69 | + try{ |
|
70 | 70 | $content = str_replace($this->option('placeholder'), $key, $content); |
71 | 71 | $content = str_replace($enc->getKey(), $key, $content); |
72 | - } catch (\Throwable $e) { |
|
72 | + }catch (\Throwable $e){ |
|
73 | 73 | // current keys is not set |
74 | 74 | } |
75 | 75 |
@@ -55,21 +55,26 @@ |
||
55 | 55 | $this->sprintf("<info>New encryption key:</info> <fg=cyan>%s</fg=cyan>\n", $key); |
56 | 56 | |
57 | 57 | $file = $this->option('mount'); |
58 | - if ($file === null) { |
|
58 | + if ($file === null) |
|
59 | + { |
|
59 | 60 | return; |
60 | 61 | } |
61 | 62 | |
62 | - if (!$files->exists($file)) { |
|
63 | + if (!$files->exists($file)) |
|
64 | + { |
|
63 | 65 | $this->sprintf('<error>Unable to find `%s`</error>', $file); |
64 | 66 | return; |
65 | 67 | } |
66 | 68 | |
67 | 69 | $content = $files->read($file); |
68 | 70 | |
69 | - try { |
|
71 | + try |
|
72 | + { |
|
70 | 73 | $content = str_replace($this->option('placeholder'), $key, $content); |
71 | 74 | $content = str_replace($enc->getKey(), $key, $content); |
72 | - } catch (\Throwable $e) { |
|
75 | + } |
|
76 | + catch (\Throwable $e) |
|
77 | + { |
|
73 | 78 | // current keys is not set |
74 | 79 | } |
75 | 80 |
@@ -26,20 +26,20 @@ discard block |
||
26 | 26 | public function perform(FilesInterface $files, DirectoriesInterface $directories): void |
27 | 27 | { |
28 | 28 | $cacheDirectory = $directories->get('cache'); |
29 | - if (!$files->exists($cacheDirectory)) { |
|
29 | + if (!$files->exists($cacheDirectory)){ |
|
30 | 30 | $this->writeln('Cache directory is missing, no cache to be cleaned.'); |
31 | 31 | |
32 | 32 | return; |
33 | 33 | } |
34 | 34 | |
35 | - if ($this->isVerbose()) { |
|
35 | + if ($this->isVerbose()){ |
|
36 | 36 | $this->writeln('<info>Cleaning application cache:</info>'); |
37 | 37 | } |
38 | 38 | |
39 | - foreach ($files->getFiles($cacheDirectory) as $filename) { |
|
40 | - try { |
|
39 | + foreach ($files->getFiles($cacheDirectory) as $filename){ |
|
40 | + try{ |
|
41 | 41 | $files->delete($filename); |
42 | - } catch (\Throwable $e) { |
|
42 | + }catch (\Throwable $e){ |
|
43 | 43 | // @codeCoverageIgnoreStart |
44 | 44 | $this->sprintf( |
45 | 45 | "<fg=red>[errored]</fg=red> `%s`: <fg=red>%s</fg=red>\n", |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | // @codeCoverageIgnoreEnd |
52 | 52 | } |
53 | 53 | |
54 | - if ($this->isVerbose()) { |
|
54 | + if ($this->isVerbose()){ |
|
55 | 55 | $this->sprintf( |
56 | 56 | "<fg=green>[deleted]</fg=green> `%s`\n", |
57 | 57 | $files->relativePath($filename, $cacheDirectory) |
@@ -26,20 +26,26 @@ discard block |
||
26 | 26 | public function perform(FilesInterface $files, DirectoriesInterface $directories): void |
27 | 27 | { |
28 | 28 | $cacheDirectory = $directories->get('cache'); |
29 | - if (!$files->exists($cacheDirectory)) { |
|
29 | + if (!$files->exists($cacheDirectory)) |
|
30 | + { |
|
30 | 31 | $this->writeln('Cache directory is missing, no cache to be cleaned.'); |
31 | 32 | |
32 | 33 | return; |
33 | 34 | } |
34 | 35 | |
35 | - if ($this->isVerbose()) { |
|
36 | + if ($this->isVerbose()) |
|
37 | + { |
|
36 | 38 | $this->writeln('<info>Cleaning application cache:</info>'); |
37 | 39 | } |
38 | 40 | |
39 | - foreach ($files->getFiles($cacheDirectory) as $filename) { |
|
40 | - try { |
|
41 | + foreach ($files->getFiles($cacheDirectory) as $filename) |
|
42 | + { |
|
43 | + try |
|
44 | + { |
|
41 | 45 | $files->delete($filename); |
42 | - } catch (\Throwable $e) { |
|
46 | + } |
|
47 | + catch (\Throwable $e) |
|
48 | + { |
|
43 | 49 | // @codeCoverageIgnoreStart |
44 | 50 | $this->sprintf( |
45 | 51 | "<fg=red>[errored]</fg=red> `%s`: <fg=red>%s</fg=red>\n", |
@@ -51,7 +57,8 @@ discard block |
||
51 | 57 | // @codeCoverageIgnoreEnd |
52 | 58 | } |
53 | 59 | |
54 | - if ($this->isVerbose()) { |
|
60 | + if ($this->isVerbose()) |
|
61 | + { |
|
55 | 62 | $this->sprintf( |
56 | 63 | "<fg=green>[deleted]</fg=green> `%s`\n", |
57 | 64 | $files->relativePath($filename, $cacheDirectory) |