@@ -23,14 +23,14 @@ discard block |
||
23 | 23 | */ |
24 | 24 | public function perform() |
25 | 25 | { |
26 | - if (!$this->verifyConfigured() || !$this->verifyEnvironment()) { |
|
26 | + if (!$this->verifyConfigured() || !$this->verifyEnvironment()){ |
|
27 | 27 | return; |
28 | 28 | } |
29 | 29 | |
30 | 30 | $found = false; |
31 | 31 | $count = $this->option('one') ? 1 : PHP_INT_MAX; |
32 | 32 | |
33 | - while ($count > 0 && ($migration = $this->migrator->run())) { |
|
33 | + while ($count > 0 && ($migration = $this->migrator->run())){ |
|
34 | 34 | $found = true; |
35 | 35 | $count--; |
36 | 36 | |
@@ -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 outstanding migrations were found.</fg=red>"); |
45 | 45 | } |
46 | 46 | } |
@@ -23,14 +23,16 @@ discard block |
||
23 | 23 | */ |
24 | 24 | public function perform() |
25 | 25 | { |
26 | - if (!$this->verifyConfigured() || !$this->verifyEnvironment()) { |
|
26 | + if (!$this->verifyConfigured() || !$this->verifyEnvironment()) |
|
27 | + { |
|
27 | 28 | return; |
28 | 29 | } |
29 | 30 | |
30 | 31 | $found = false; |
31 | 32 | $count = $this->option('one') ? 1 : PHP_INT_MAX; |
32 | 33 | |
33 | - while ($count > 0 && ($migration = $this->migrator->run())) { |
|
34 | + while ($count > 0 && ($migration = $this->migrator->run())) |
|
35 | + { |
|
34 | 36 | $found = true; |
35 | 37 | $count--; |
36 | 38 | |
@@ -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 outstanding migrations were found.</fg=red>"); |
45 | 48 | } |
46 | 49 | } |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | protected function verifyConfigured(): bool |
42 | 42 | { |
43 | - if (!$this->migrator->isConfigured()) { |
|
43 | + if (!$this->migrator->isConfigured()){ |
|
44 | 44 | $this->writeln( |
45 | 45 | "<fg=red>Migrations are not configured yet, run '<info>migrate:init</info>' first.</fg=red>" |
46 | 46 | ); |
@@ -58,14 +58,14 @@ discard block |
||
58 | 58 | */ |
59 | 59 | protected function verifyEnvironment(): bool |
60 | 60 | { |
61 | - if ($this->option('force') || $this->config->isSafe()) { |
|
61 | + if ($this->option('force') || $this->config->isSafe()){ |
|
62 | 62 | //Safe to run |
63 | 63 | return true; |
64 | 64 | } |
65 | 65 | |
66 | 66 | $this->writeln("<fg=red>Confirmation is required to run migrations!</fg=red>"); |
67 | 67 | |
68 | - if (!$this->askConfirmation()) { |
|
68 | + if (!$this->askConfirmation()){ |
|
69 | 69 | $this->writeln("<comment>Cancelling operation...</comment>"); |
70 | 70 | |
71 | 71 | return false; |
@@ -40,7 +40,8 @@ discard block |
||
40 | 40 | */ |
41 | 41 | protected function verifyConfigured(): bool |
42 | 42 | { |
43 | - if (!$this->migrator->isConfigured()) { |
|
43 | + if (!$this->migrator->isConfigured()) |
|
44 | + { |
|
44 | 45 | $this->writeln( |
45 | 46 | "<fg=red>Migrations are not configured yet, run '<info>migrate:init</info>' first.</fg=red>" |
46 | 47 | ); |
@@ -58,14 +59,16 @@ discard block |
||
58 | 59 | */ |
59 | 60 | protected function verifyEnvironment(): bool |
60 | 61 | { |
61 | - if ($this->option('force') || $this->config->isSafe()) { |
|
62 | + if ($this->option('force') || $this->config->isSafe()) |
|
63 | + { |
|
62 | 64 | //Safe to run |
63 | 65 | return true; |
64 | 66 | } |
65 | 67 | |
66 | 68 | $this->writeln("<fg=red>Confirmation is required to run migrations!</fg=red>"); |
67 | 69 | |
68 | - if (!$this->askConfirmation()) { |
|
70 | + if (!$this->askConfirmation()) |
|
71 | + { |
|
69 | 72 | $this->writeln("<comment>Cancelling operation...</comment>"); |
70 | 73 | |
71 | 74 | return false; |
@@ -27,18 +27,18 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function perform(FilesInterface $files) |
29 | 29 | { |
30 | - if (!$this->verifyConfigured()) { |
|
30 | + if (!$this->verifyConfigured()){ |
|
31 | 31 | return; |
32 | 32 | } |
33 | 33 | |
34 | - if (empty($this->migrator->getMigrations())) { |
|
34 | + if (empty($this->migrator->getMigrations())){ |
|
35 | 35 | $this->writeln("<comment>No migrations were found.</comment>"); |
36 | 36 | |
37 | 37 | return; |
38 | 38 | } |
39 | 39 | |
40 | 40 | $table = $this->table(['Migration', 'Filename', 'Created at', 'Executed at']); |
41 | - foreach ($this->migrator->getMigrations() as $migration) { |
|
41 | + foreach ($this->migrator->getMigrations() as $migration){ |
|
42 | 42 | $filename = (new \ReflectionClass($migration))->getFileName(); |
43 | 43 | |
44 | 44 | $state = $migration->getState(); |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | $state->getTimeCreated()->format('Y-m-d H:i:s'), |
52 | 52 | $state->getStatus() == State::STATUS_PENDING |
53 | 53 | ? self::PENDING |
54 | - : '<info>' . $state->getTimeExecuted()->format('Y-m-d H:i:s') . '</info>' |
|
54 | + : '<info>'.$state->getTimeExecuted()->format('Y-m-d H:i:s').'</info>' |
|
55 | 55 | ]); |
56 | 56 | } |
57 | 57 |
@@ -27,18 +27,21 @@ |
||
27 | 27 | */ |
28 | 28 | public function perform(FilesInterface $files) |
29 | 29 | { |
30 | - if (!$this->verifyConfigured()) { |
|
30 | + if (!$this->verifyConfigured()) |
|
31 | + { |
|
31 | 32 | return; |
32 | 33 | } |
33 | 34 | |
34 | - if (empty($this->migrator->getMigrations())) { |
|
35 | + if (empty($this->migrator->getMigrations())) |
|
36 | + { |
|
35 | 37 | $this->writeln("<comment>No migrations were found.</comment>"); |
36 | 38 | |
37 | 39 | return; |
38 | 40 | } |
39 | 41 | |
40 | 42 | $table = $this->table(['Migration', 'Filename', 'Created at', 'Executed at']); |
41 | - foreach ($this->migrator->getMigrations() as $migration) { |
|
43 | + foreach ($this->migrator->getMigrations() as $migration) |
|
44 | + { |
|
42 | 45 | $filename = (new \ReflectionClass($migration))->getFileName(); |
43 | 46 | |
44 | 47 | $state = $migration->getState(); |
@@ -23,14 +23,14 @@ discard block |
||
23 | 23 | */ |
24 | 24 | public function perform() |
25 | 25 | { |
26 | - if (!$this->verifyConfigured() || !$this->verifyEnvironment()) { |
|
26 | + if (!$this->verifyConfigured() || !$this->verifyEnvironment()){ |
|
27 | 27 | //Making sure we can safely migrate in this environment |
28 | 28 | return; |
29 | 29 | } |
30 | 30 | |
31 | 31 | $found = false; |
32 | 32 | $count = !$this->option('all') ? 1 : PHP_INT_MAX; |
33 | - while ($count > 0 && ($migration = $this->migrator->rollback())) { |
|
33 | + while ($count > 0 && ($migration = $this->migrator->rollback())){ |
|
34 | 34 | $found = true; |
35 | 35 | $count--; |
36 | 36 | $this->sprintf( |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | ); |
40 | 40 | } |
41 | 41 | |
42 | - if (!$found) { |
|
42 | + if (!$found){ |
|
43 | 43 | $this->writeln("<fg=red>No executed migrations were found.</fg=red>"); |
44 | 44 | } |
45 | 45 | } |
@@ -23,14 +23,16 @@ discard block |
||
23 | 23 | */ |
24 | 24 | public function perform() |
25 | 25 | { |
26 | - if (!$this->verifyConfigured() || !$this->verifyEnvironment()) { |
|
26 | + if (!$this->verifyConfigured() || !$this->verifyEnvironment()) |
|
27 | + { |
|
27 | 28 | //Making sure we can safely migrate in this environment |
28 | 29 | return; |
29 | 30 | } |
30 | 31 | |
31 | 32 | $found = false; |
32 | 33 | $count = !$this->option('all') ? 1 : PHP_INT_MAX; |
33 | - while ($count > 0 && ($migration = $this->migrator->rollback())) { |
|
34 | + while ($count > 0 && ($migration = $this->migrator->rollback())) |
|
35 | + { |
|
34 | 36 | $found = true; |
35 | 37 | $count--; |
36 | 38 | $this->sprintf( |
@@ -39,7 +41,8 @@ discard block |
||
39 | 41 | ); |
40 | 42 | } |
41 | 43 | |
42 | - if (!$found) { |
|
44 | + if (!$found) |
|
45 | + { |
|
43 | 46 | $this->writeln("<fg=red>No executed migrations were found.</fg=red>"); |
44 | 47 | } |
45 | 48 | } |
@@ -25,20 +25,20 @@ discard block |
||
25 | 25 | public function perform(FilesInterface $files, DirectoriesInterface $directories) |
26 | 26 | { |
27 | 27 | $cacheDirectory = $directories->get('cache'); |
28 | - if (!$files->exists($cacheDirectory)) { |
|
28 | + if (!$files->exists($cacheDirectory)){ |
|
29 | 29 | $this->writeln("Cache directory is missing, no cache to be cleaned."); |
30 | 30 | |
31 | 31 | return; |
32 | 32 | } |
33 | 33 | |
34 | - if ($this->isVerbose()) { |
|
34 | + if ($this->isVerbose()){ |
|
35 | 35 | $this->writeln("<info>Cleaning application cache:</info>"); |
36 | 36 | } |
37 | 37 | |
38 | - foreach ($files->getFiles($cacheDirectory) as $filename) { |
|
39 | - try { |
|
38 | + foreach ($files->getFiles($cacheDirectory) as $filename){ |
|
39 | + try{ |
|
40 | 40 | $files->delete($filename); |
41 | - } catch (\Throwable $e) { |
|
41 | + }catch (\Throwable $e){ |
|
42 | 42 | $this->sprintf("<fg=red>[errored]</fg=red> `%s`: <fg=red>%s</fg=red>\n", |
43 | 43 | $files->relativePath($filename, $cacheDirectory), |
44 | 44 | $e->getMessage() |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | continue; |
48 | 48 | } |
49 | 49 | |
50 | - if ($this->isVerbose()) { |
|
50 | + if ($this->isVerbose()){ |
|
51 | 51 | $this->sprintf( |
52 | 52 | "<fg=green>[deleted]</fg=green> `%s`\n", |
53 | 53 | $files->relativePath($filename, $cacheDirectory) |
@@ -25,20 +25,26 @@ discard block |
||
25 | 25 | public function perform(FilesInterface $files, DirectoriesInterface $directories) |
26 | 26 | { |
27 | 27 | $cacheDirectory = $directories->get('cache'); |
28 | - if (!$files->exists($cacheDirectory)) { |
|
28 | + if (!$files->exists($cacheDirectory)) |
|
29 | + { |
|
29 | 30 | $this->writeln("Cache directory is missing, no cache to be cleaned."); |
30 | 31 | |
31 | 32 | return; |
32 | 33 | } |
33 | 34 | |
34 | - if ($this->isVerbose()) { |
|
35 | + if ($this->isVerbose()) |
|
36 | + { |
|
35 | 37 | $this->writeln("<info>Cleaning application cache:</info>"); |
36 | 38 | } |
37 | 39 | |
38 | - foreach ($files->getFiles($cacheDirectory) as $filename) { |
|
39 | - try { |
|
40 | + foreach ($files->getFiles($cacheDirectory) as $filename) |
|
41 | + { |
|
42 | + try |
|
43 | + { |
|
40 | 44 | $files->delete($filename); |
41 | - } catch (\Throwable $e) { |
|
45 | + } |
|
46 | + catch (\Throwable $e) |
|
47 | + { |
|
42 | 48 | $this->sprintf("<fg=red>[errored]</fg=red> `%s`: <fg=red>%s</fg=red>\n", |
43 | 49 | $files->relativePath($filename, $cacheDirectory), |
44 | 50 | $e->getMessage() |
@@ -47,7 +53,8 @@ discard block |
||
47 | 53 | continue; |
48 | 54 | } |
49 | 55 | |
50 | - if ($this->isVerbose()) { |
|
56 | + if ($this->isVerbose()) |
|
57 | + { |
|
51 | 58 | $this->sprintf( |
52 | 59 | "<fg=green>[deleted]</fg=green> `%s`\n", |
53 | 60 | $files->relativePath($filename, $cacheDirectory) |
@@ -22,7 +22,7 @@ |
||
22 | 22 | public function perform() |
23 | 23 | { |
24 | 24 | $grid = $this->table(['Extension:', 'Version:']); |
25 | - foreach (get_loaded_extensions() as $extension) { |
|
25 | + foreach (get_loaded_extensions() as $extension){ |
|
26 | 26 | $grid->addRow([$extension, phpversion($extension)]); |
27 | 27 | } |
28 | 28 | $grid->render(); |
@@ -22,7 +22,8 @@ |
||
22 | 22 | public function perform() |
23 | 23 | { |
24 | 24 | $grid = $this->table(['Extension:', 'Version:']); |
25 | - foreach (get_loaded_extensions() as $extension) { |
|
25 | + foreach (get_loaded_extensions() as $extension) |
|
26 | + { |
|
26 | 27 | $grid->addRow([$extension, phpversion($extension)]); |
27 | 28 | } |
28 | 29 | $grid->render(); |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | $database = $dbal->database($this->option('database')); |
42 | 42 | $schema = $database->table($this->argument('table'))->getSchema(); |
43 | 43 | |
44 | - if (!$schema->exists()) { |
|
44 | + if (!$schema->exists()){ |
|
45 | 45 | throw new DBALException( |
46 | 46 | "Table {$database->getName()}.{$this->argument('table')} does not exists." |
47 | 47 | ); |
@@ -55,11 +55,11 @@ discard block |
||
55 | 55 | |
56 | 56 | $this->describeColumns($schema); |
57 | 57 | |
58 | - if (!empty($indexes = $schema->getIndexes())) { |
|
58 | + if (!empty($indexes = $schema->getIndexes())){ |
|
59 | 59 | $this->describeIndexes($database, $indexes); |
60 | 60 | } |
61 | 61 | |
62 | - if (!empty($foreignKeys = $schema->getForeignKeys())) { |
|
62 | + if (!empty($foreignKeys = $schema->getForeignKeys())){ |
|
63 | 63 | $this->describeForeignKeys($database, $foreignKeys); |
64 | 64 | } |
65 | 65 | |
@@ -79,34 +79,34 @@ discard block |
||
79 | 79 | 'Default Value:' |
80 | 80 | ]); |
81 | 81 | |
82 | - foreach ($schema->getColumns() as $column) { |
|
82 | + foreach ($schema->getColumns() as $column){ |
|
83 | 83 | $name = $column->getName(); |
84 | 84 | $type = $column->getType(); |
85 | 85 | |
86 | 86 | $abstractType = $column->getAbstractType(); |
87 | 87 | $defaultValue = $column->getDefaultValue(); |
88 | 88 | |
89 | - if ($column->getSize()) { |
|
89 | + if ($column->getSize()){ |
|
90 | 90 | $type .= " ({$column->getSize()})"; |
91 | 91 | } |
92 | 92 | |
93 | - if ($abstractType == 'decimal') { |
|
93 | + if ($abstractType == 'decimal'){ |
|
94 | 94 | $type .= " ({$column->getPrecision()}, {$column->getScale()})"; |
95 | 95 | } |
96 | 96 | |
97 | - if (in_array($column->getName(), $schema->getPrimaryKeys())) { |
|
97 | + if (in_array($column->getName(), $schema->getPrimaryKeys())){ |
|
98 | 98 | $name = "<fg=magenta>{$name}</fg=magenta>"; |
99 | 99 | } |
100 | 100 | |
101 | - if (in_array($abstractType, ['primary', 'bigPrimary'])) { |
|
101 | + if (in_array($abstractType, ['primary', 'bigPrimary'])){ |
|
102 | 102 | $abstractType = "<fg=magenta>{$abstractType}</fg=magenta>"; |
103 | 103 | } |
104 | 104 | |
105 | - if ($defaultValue instanceof FragmentInterface) { |
|
105 | + if ($defaultValue instanceof FragmentInterface){ |
|
106 | 106 | $defaultValue = "<info>{$defaultValue}</info>"; |
107 | 107 | } |
108 | 108 | |
109 | - if ($defaultValue instanceof \DateTimeInterface) { |
|
109 | + if ($defaultValue instanceof \DateTimeInterface){ |
|
110 | 110 | $defaultValue = $defaultValue->format('c'); |
111 | 111 | } |
112 | 112 | |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | ); |
136 | 136 | |
137 | 137 | $indexesTable = $this->table(['Name:', 'Type:', 'Columns:']); |
138 | - foreach ($indexes as $index) { |
|
138 | + foreach ($indexes as $index){ |
|
139 | 139 | $indexesTable->addRow([ |
140 | 140 | $index->getName(), |
141 | 141 | $index->isUnique() ? 'UNIQUE INDEX' : 'INDEX', |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | 'On Update:' |
167 | 167 | ]); |
168 | 168 | |
169 | - foreach ($foreignKeys as $reference) { |
|
169 | + foreach ($foreignKeys as $reference){ |
|
170 | 170 | $foreignTable->addRow([ |
171 | 171 | $reference->getName(), |
172 | 172 | $reference->getColumn(), |
@@ -41,7 +41,8 @@ discard block |
||
41 | 41 | $database = $dbal->database($this->option('database')); |
42 | 42 | $schema = $database->table($this->argument('table'))->getSchema(); |
43 | 43 | |
44 | - if (!$schema->exists()) { |
|
44 | + if (!$schema->exists()) |
|
45 | + { |
|
45 | 46 | throw new DBALException( |
46 | 47 | "Table {$database->getName()}.{$this->argument('table')} does not exists." |
47 | 48 | ); |
@@ -55,11 +56,13 @@ discard block |
||
55 | 56 | |
56 | 57 | $this->describeColumns($schema); |
57 | 58 | |
58 | - if (!empty($indexes = $schema->getIndexes())) { |
|
59 | + if (!empty($indexes = $schema->getIndexes())) |
|
60 | + { |
|
59 | 61 | $this->describeIndexes($database, $indexes); |
60 | 62 | } |
61 | 63 | |
62 | - if (!empty($foreignKeys = $schema->getForeignKeys())) { |
|
64 | + if (!empty($foreignKeys = $schema->getForeignKeys())) |
|
65 | + { |
|
63 | 66 | $this->describeForeignKeys($database, $foreignKeys); |
64 | 67 | } |
65 | 68 | |
@@ -79,34 +82,41 @@ discard block |
||
79 | 82 | 'Default Value:' |
80 | 83 | ]); |
81 | 84 | |
82 | - foreach ($schema->getColumns() as $column) { |
|
85 | + foreach ($schema->getColumns() as $column) |
|
86 | + { |
|
83 | 87 | $name = $column->getName(); |
84 | 88 | $type = $column->getType(); |
85 | 89 | |
86 | 90 | $abstractType = $column->getAbstractType(); |
87 | 91 | $defaultValue = $column->getDefaultValue(); |
88 | 92 | |
89 | - if ($column->getSize()) { |
|
93 | + if ($column->getSize()) |
|
94 | + { |
|
90 | 95 | $type .= " ({$column->getSize()})"; |
91 | 96 | } |
92 | 97 | |
93 | - if ($abstractType == 'decimal') { |
|
98 | + if ($abstractType == 'decimal') |
|
99 | + { |
|
94 | 100 | $type .= " ({$column->getPrecision()}, {$column->getScale()})"; |
95 | 101 | } |
96 | 102 | |
97 | - if (in_array($column->getName(), $schema->getPrimaryKeys())) { |
|
103 | + if (in_array($column->getName(), $schema->getPrimaryKeys())) |
|
104 | + { |
|
98 | 105 | $name = "<fg=magenta>{$name}</fg=magenta>"; |
99 | 106 | } |
100 | 107 | |
101 | - if (in_array($abstractType, ['primary', 'bigPrimary'])) { |
|
108 | + if (in_array($abstractType, ['primary', 'bigPrimary'])) |
|
109 | + { |
|
102 | 110 | $abstractType = "<fg=magenta>{$abstractType}</fg=magenta>"; |
103 | 111 | } |
104 | 112 | |
105 | - if ($defaultValue instanceof FragmentInterface) { |
|
113 | + if ($defaultValue instanceof FragmentInterface) |
|
114 | + { |
|
106 | 115 | $defaultValue = "<info>{$defaultValue}</info>"; |
107 | 116 | } |
108 | 117 | |
109 | - if ($defaultValue instanceof \DateTimeInterface) { |
|
118 | + if ($defaultValue instanceof \DateTimeInterface) |
|
119 | + { |
|
110 | 120 | $defaultValue = $defaultValue->format('c'); |
111 | 121 | } |
112 | 122 | |
@@ -135,7 +145,8 @@ discard block |
||
135 | 145 | ); |
136 | 146 | |
137 | 147 | $indexesTable = $this->table(['Name:', 'Type:', 'Columns:']); |
138 | - foreach ($indexes as $index) { |
|
148 | + foreach ($indexes as $index) |
|
149 | + { |
|
139 | 150 | $indexesTable->addRow([ |
140 | 151 | $index->getName(), |
141 | 152 | $index->isUnique() ? 'UNIQUE INDEX' : 'INDEX', |
@@ -166,7 +177,8 @@ discard block |
||
166 | 177 | 'On Update:' |
167 | 178 | ]); |
168 | 179 | |
169 | - foreach ($foreignKeys as $reference) { |
|
180 | + foreach ($foreignKeys as $reference) |
|
181 | + { |
|
170 | 182 | $foreignTable->addRow([ |
171 | 183 | $reference->getName(), |
172 | 184 | $reference->getColumn(), |
@@ -43,7 +43,7 @@ |
||
43 | 43 | |
44 | 44 | if (!$schema->exists()) { |
45 | 45 | throw new DBALException( |
46 | - "Table {$database->getName()}.{$this->argument('table')} does not exists." |
|
46 | + "table {$database->getName()}.{$this->argument('table')} does not exists." |
|
47 | 47 | ); |
48 | 48 | } |
49 | 49 |
@@ -29,13 +29,13 @@ discard block |
||
29 | 29 | */ |
30 | 30 | public function perform(DatabaseConfig $config, DatabaseManager $dbal) |
31 | 31 | { |
32 | - if ($this->argument('db')) { |
|
32 | + if ($this->argument('db')){ |
|
33 | 33 | $databases = [$this->argument('db')]; |
34 | - } else { |
|
34 | + }else{ |
|
35 | 35 | $databases = array_keys($config->getDatabases()); |
36 | 36 | } |
37 | 37 | |
38 | - if (empty($databases)) { |
|
38 | + if (empty($databases)){ |
|
39 | 39 | $this->writeln("<fg=red>No databases found.</fg=red>"); |
40 | 40 | |
41 | 41 | return; |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | 'Count Records:' |
52 | 52 | ]); |
53 | 53 | |
54 | - foreach ($databases as $database) { |
|
54 | + foreach ($databases as $database){ |
|
55 | 55 | $database = $dbal->database($database); |
56 | 56 | |
57 | 57 | /** @var AbstractDriver $driver */ |
@@ -64,10 +64,10 @@ discard block |
||
64 | 64 | $database->getPrefix() ?: '<comment>---</comment>' |
65 | 65 | ]; |
66 | 66 | |
67 | - try { |
|
67 | + try{ |
|
68 | 68 | |
69 | 69 | $driver->connect(); |
70 | - } catch (\Exception $exception) { |
|
70 | + }catch (\Exception $exception){ |
|
71 | 71 | $grid->addRow(array_merge( |
72 | 72 | $header, |
73 | 73 | [ |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | ] |
78 | 78 | )); |
79 | 79 | |
80 | - if ($database->getName() != end($databases)) { |
|
80 | + if ($database->getName() != end($databases)){ |
|
81 | 81 | $grid->addRow(new TableSeparator()); |
82 | 82 | } |
83 | 83 | |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | } |
86 | 86 | |
87 | 87 | $header[] = "<info>connected</info>"; |
88 | - foreach ($database->getTables() as $table) { |
|
88 | + foreach ($database->getTables() as $table){ |
|
89 | 89 | $grid->addRow(array_merge( |
90 | 90 | $header, |
91 | 91 | [$table->getName(), number_format($table->count())] |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | } |
95 | 95 | |
96 | 96 | $header[1] && $grid->addRow(array_merge($header, ["no tables", "no records"])); |
97 | - if ($database->getName() != end($databases)) { |
|
97 | + if ($database->getName() != end($databases)){ |
|
98 | 98 | $grid->addRow(new TableSeparator()); |
99 | 99 | } |
100 | 100 | } |
@@ -29,13 +29,17 @@ discard block |
||
29 | 29 | */ |
30 | 30 | public function perform(DatabaseConfig $config, DatabaseManager $dbal) |
31 | 31 | { |
32 | - if ($this->argument('db')) { |
|
32 | + if ($this->argument('db')) |
|
33 | + { |
|
33 | 34 | $databases = [$this->argument('db')]; |
34 | - } else { |
|
35 | + } |
|
36 | + else |
|
37 | + { |
|
35 | 38 | $databases = array_keys($config->getDatabases()); |
36 | 39 | } |
37 | 40 | |
38 | - if (empty($databases)) { |
|
41 | + if (empty($databases)) |
|
42 | + { |
|
39 | 43 | $this->writeln("<fg=red>No databases found.</fg=red>"); |
40 | 44 | |
41 | 45 | return; |
@@ -51,7 +55,8 @@ discard block |
||
51 | 55 | 'Count Records:' |
52 | 56 | ]); |
53 | 57 | |
54 | - foreach ($databases as $database) { |
|
58 | + foreach ($databases as $database) |
|
59 | + { |
|
55 | 60 | $database = $dbal->database($database); |
56 | 61 | |
57 | 62 | /** @var AbstractDriver $driver */ |
@@ -64,10 +69,13 @@ discard block |
||
64 | 69 | $database->getPrefix() ?: '<comment>---</comment>' |
65 | 70 | ]; |
66 | 71 | |
67 | - try { |
|
72 | + try |
|
73 | + { |
|
68 | 74 | |
69 | 75 | $driver->connect(); |
70 | - } catch (\Exception $exception) { |
|
76 | + } |
|
77 | + catch (\Exception $exception) |
|
78 | + { |
|
71 | 79 | $grid->addRow(array_merge( |
72 | 80 | $header, |
73 | 81 | [ |
@@ -77,7 +85,8 @@ discard block |
||
77 | 85 | ] |
78 | 86 | )); |
79 | 87 | |
80 | - if ($database->getName() != end($databases)) { |
|
88 | + if ($database->getName() != end($databases)) |
|
89 | + { |
|
81 | 90 | $grid->addRow(new TableSeparator()); |
82 | 91 | } |
83 | 92 | |
@@ -85,7 +94,8 @@ discard block |
||
85 | 94 | } |
86 | 95 | |
87 | 96 | $header[] = "<info>connected</info>"; |
88 | - foreach ($database->getTables() as $table) { |
|
97 | + foreach ($database->getTables() as $table) |
|
98 | + { |
|
89 | 99 | $grid->addRow(array_merge( |
90 | 100 | $header, |
91 | 101 | [$table->getName(), number_format($table->count())] |
@@ -94,7 +104,8 @@ discard block |
||
94 | 104 | } |
95 | 105 | |
96 | 106 | $header[1] && $grid->addRow(array_merge($header, ["no tables", "no records"])); |
97 | - if ($database->getName() != end($databases)) { |
|
107 | + if ($database->getName() != end($databases)) |
|
108 | + { |
|
98 | 109 | $grid->addRow(new TableSeparator()); |
99 | 110 | } |
100 | 111 | } |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | */ |
38 | 38 | public function perform(TranslatorConfig $config, CatalogueManager $manager) |
39 | 39 | { |
40 | - if (!$config->hasDumper($this->option('dumper'))) { |
|
40 | + if (!$config->hasDumper($this->option('dumper'))){ |
|
41 | 41 | $this->writeln("<fg=red>Undefined dumper '{$this->option('dumper')}'.</fg=red>"); |
42 | 42 | |
43 | 43 | return; |
@@ -50,17 +50,17 @@ discard block |
||
50 | 50 | $catalogue->getData() |
51 | 51 | ); |
52 | 52 | |
53 | - if ($this->option('fallback')) { |
|
54 | - foreach ($manager->get($config->fallbackLocale())->getData() as $domain => $messages) { |
|
55 | - foreach ($messages as $id => $message) { |
|
56 | - if (!$messageCatalogue->defines($id, $domain)) { |
|
53 | + if ($this->option('fallback')){ |
|
54 | + foreach ($manager->get($config->fallbackLocale())->getData() as $domain => $messages){ |
|
55 | + foreach ($messages as $id => $message){ |
|
56 | + if (!$messageCatalogue->defines($id, $domain)){ |
|
57 | 57 | $messageCatalogue->set($id, $message, $domain); |
58 | 58 | } |
59 | 59 | } |
60 | 60 | } |
61 | 61 | } |
62 | 62 | |
63 | - if ($this->isVerbose() && !empty($messageCatalogue->getDomains())) { |
|
63 | + if ($this->isVerbose() && !empty($messageCatalogue->getDomains())){ |
|
64 | 64 | $this->sprintf("<info>Exporting domain(s):</info> %s\n", |
65 | 65 | join(',', $messageCatalogue->getDomains()) |
66 | 66 | ); |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | 'xliff_version' => '2.0' // forcing default version for xliff dumper only |
75 | 75 | ]); |
76 | 76 | |
77 | - $this->writeln("Export successfully completed using <info>" . get_class($dumper) . "</info>"); |
|
78 | - $this->writeln("Output: <comment>" . realpath($this->argument('path')) . "</comment>"); |
|
77 | + $this->writeln("Export successfully completed using <info>".get_class($dumper)."</info>"); |
|
78 | + $this->writeln("Output: <comment>".realpath($this->argument('path'))."</comment>"); |
|
79 | 79 | } |
80 | 80 | } |
81 | 81 | \ No newline at end of file |
@@ -37,7 +37,8 @@ discard block |
||
37 | 37 | */ |
38 | 38 | public function perform(TranslatorConfig $config, CatalogueManager $manager) |
39 | 39 | { |
40 | - if (!$config->hasDumper($this->option('dumper'))) { |
|
40 | + if (!$config->hasDumper($this->option('dumper'))) |
|
41 | + { |
|
41 | 42 | $this->writeln("<fg=red>Undefined dumper '{$this->option('dumper')}'.</fg=red>"); |
42 | 43 | |
43 | 44 | return; |
@@ -50,17 +51,22 @@ discard block |
||
50 | 51 | $catalogue->getData() |
51 | 52 | ); |
52 | 53 | |
53 | - if ($this->option('fallback')) { |
|
54 | - foreach ($manager->get($config->fallbackLocale())->getData() as $domain => $messages) { |
|
55 | - foreach ($messages as $id => $message) { |
|
56 | - if (!$messageCatalogue->defines($id, $domain)) { |
|
54 | + if ($this->option('fallback')) |
|
55 | + { |
|
56 | + foreach ($manager->get($config->fallbackLocale())->getData() as $domain => $messages) |
|
57 | + { |
|
58 | + foreach ($messages as $id => $message) |
|
59 | + { |
|
60 | + if (!$messageCatalogue->defines($id, $domain)) |
|
61 | + { |
|
57 | 62 | $messageCatalogue->set($id, $message, $domain); |
58 | 63 | } |
59 | 64 | } |
60 | 65 | } |
61 | 66 | } |
62 | 67 | |
63 | - if ($this->isVerbose() && !empty($messageCatalogue->getDomains())) { |
|
68 | + if ($this->isVerbose() && !empty($messageCatalogue->getDomains())) |
|
69 | + { |
|
64 | 70 | $this->sprintf("<info>Exporting domain(s):</info> %s\n", |
65 | 71 | join(',', $messageCatalogue->getDomains()) |
66 | 72 | ); |