@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | )) |
46 | 46 | ->setTables($this->getTables()) |
47 | 47 | ->setSkipTables($this->getSkipTables()) |
48 | - ->setLimit((int) $this->getLimit()) |
|
48 | + ->setLimit((int)$this->getLimit()) |
|
49 | 49 | ->setOptions($this->options()) |
50 | 50 | ->run(); |
51 | 51 | } catch (DatabaseConnectionException $e) { |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | return; |
55 | 55 | } |
56 | 56 | |
57 | - $this->info(PHP_EOL.'Synchronization done!'); |
|
57 | + $this->info(PHP_EOL . 'Synchronization done!'); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | private function getTables() |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | public function setOptions(array $options) |
62 | 62 | { |
63 | 63 | foreach ($options as $option => $value) { |
64 | - if (! isset($this->{$option})) { |
|
64 | + if (!isset($this->{$option})) { |
|
65 | 65 | $this->{$option} = $value; |
66 | 66 | } |
67 | 67 | } |
@@ -93,17 +93,17 @@ discard block |
||
93 | 93 | $this->tables = $this->getFromDb()->getDoctrineSchemaManager()->listTableNames(); |
94 | 94 | } |
95 | 95 | |
96 | - return array_filter($this->tables, function ($table) { |
|
97 | - return ! in_array($table, $this->skipTables, true); |
|
96 | + return array_filter($this->tables, function($table) { |
|
97 | + return !in_array($table, $this->skipTables, true); |
|
98 | 98 | }); |
99 | 99 | } |
100 | 100 | |
101 | 101 | public function run(): void |
102 | 102 | { |
103 | 103 | foreach ($this->getTables() as $table) { |
104 | - $this->feedback(PHP_EOL.PHP_EOL."Table: $table", 'line'); |
|
104 | + $this->feedback(PHP_EOL . PHP_EOL . "Table: $table", 'line'); |
|
105 | 105 | |
106 | - if (! Schema::connection($this->from)->hasTable($table)) { |
|
106 | + if (!Schema::connection($this->from)->hasTable($table)) { |
|
107 | 107 | $this->feedback("Table '$table' does not exist in $this->from", 'error'); |
108 | 108 | |
109 | 109 | continue; |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | $builder = $this->fromDB->table($table); |
157 | 157 | $statement = $pdo->prepare($builder->toSql()); |
158 | 158 | |
159 | - if (! $statement instanceof \PDOStatement) { |
|
159 | + if (!$statement instanceof \PDOStatement) { |
|
160 | 160 | return; |
161 | 161 | } |
162 | 162 | |
@@ -179,10 +179,10 @@ discard block |
||
179 | 179 | while ($row = $statement->fetch(\PDO::FETCH_OBJ)) { |
180 | 180 | $exists = $this->getToDb()->table($table)->where($queryColumn, $row->{$queryColumn})->first(); |
181 | 181 | |
182 | - if (! $exists) { |
|
183 | - $this->getToDb()->table($table)->insert((array) $row); |
|
182 | + if (!$exists) { |
|
183 | + $this->getToDb()->table($table)->insert((array)$row); |
|
184 | 184 | } else { |
185 | - $this->getToDb()->table($table)->where($queryColumn, $row->{$queryColumn})->update((array) $row); |
|
185 | + $this->getToDb()->table($table)->where($queryColumn, $row->{$queryColumn})->update((array)$row); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | if (isset($bar)) { |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | { |
200 | 200 | $this->feedback("Creating '$this->to.$table' table", 'warn'); |
201 | 201 | |
202 | - Schema::connection($this->to)->create($table, function (Blueprint $table_bp) use ($table, $columns) { |
|
202 | + Schema::connection($this->to)->create($table, function(Blueprint $table_bp) use ($table, $columns) { |
|
203 | 203 | foreach ($columns as $column) { |
204 | 204 | $type = Schema::connection($this->from)->getColumnType($table, $column); |
205 | 205 | |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | |
213 | 213 | private function updateTable(string $table, string $column): void |
214 | 214 | { |
215 | - Schema::connection($this->to)->table($table, function (Blueprint $table_bp) use ($table, $column) { |
|
215 | + Schema::connection($this->to)->table($table, function(Blueprint $table_bp) use ($table, $column) { |
|
216 | 216 | $type = Schema::connection($this->from)->getColumnType($table, $column); |
217 | 217 | |
218 | 218 | $table_bp->{$type}($column)->nullable(); |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | if ($this->cli) { |
227 | 227 | $this->cli->{$type}($msg); |
228 | 228 | } else { |
229 | - echo PHP_EOL.$msg.PHP_EOL; |
|
229 | + echo PHP_EOL . $msg . PHP_EOL; |
|
230 | 230 | } |
231 | 231 | } |
232 | 232 | } |