@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | public function setOptions(array $options) |
63 | 63 | { |
64 | 64 | foreach ($options as $option => $value) { |
65 | - if (! isset($this->{$option})) { |
|
65 | + if (!isset($this->{$option})) { |
|
66 | 66 | $this->{$option} = $value; |
67 | 67 | } |
68 | 68 | } |
@@ -94,17 +94,17 @@ discard block |
||
94 | 94 | $this->tables = $this->getFromDb()->getDoctrineSchemaManager()->listTableNames(); |
95 | 95 | } |
96 | 96 | |
97 | - return array_filter($this->tables, function ($table) { |
|
98 | - return ! in_array($table, $this->skipTables, true); |
|
97 | + return array_filter($this->tables, function($table) { |
|
98 | + return !in_array($table, $this->skipTables, true); |
|
99 | 99 | }); |
100 | 100 | } |
101 | 101 | |
102 | 102 | public function run(): void |
103 | 103 | { |
104 | 104 | foreach ($this->getTables() as $table) { |
105 | - $this->feedback(PHP_EOL.PHP_EOL."Table: $table", 'line'); |
|
105 | + $this->feedback(PHP_EOL . PHP_EOL . "Table: $table", 'line'); |
|
106 | 106 | |
107 | - if (! Schema::connection($this->from)->hasTable($table)) { |
|
107 | + if (!Schema::connection($this->from)->hasTable($table)) { |
|
108 | 108 | $this->feedback("Table '$table' does not exist in $this->from", 'error'); |
109 | 109 | |
110 | 110 | continue; |
@@ -157,10 +157,10 @@ discard block |
||
157 | 157 | while ($row = $statement->fetch(\PDO::FETCH_OBJ)) { |
158 | 158 | $exists = $this->getToDb()->table($table)->where($queryColumn, $row->{$queryColumn})->first(); |
159 | 159 | |
160 | - if (! $exists) { |
|
161 | - $this->getToDb()->table($table)->insert((array) $row); |
|
160 | + if (!$exists) { |
|
161 | + $this->getToDb()->table($table)->insert((array)$row); |
|
162 | 162 | } else { |
163 | - $this->getToDb()->table($table)->where($queryColumn, $row->{$queryColumn})->update((array) $row); |
|
163 | + $this->getToDb()->table($table)->where($queryColumn, $row->{$queryColumn})->update((array)$row); |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | if ($this->cli) { |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | $builder = $this->fromDB->table($table); |
184 | 184 | $statement = $pdo->prepare($builder->toSql()); |
185 | 185 | |
186 | - if (! $statement instanceof \PDOStatement) { |
|
186 | + if (!$statement instanceof \PDOStatement) { |
|
187 | 187 | throw new PDOException("Could not prepare PDOStatement for $table"); |
188 | 188 | } |
189 | 189 | |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | { |
211 | 211 | $this->feedback("Creating '$this->to.$table' table", 'warn'); |
212 | 212 | |
213 | - Schema::connection($this->to)->create($table, function (Blueprint $table_bp) use ($table, $columns) { |
|
213 | + Schema::connection($this->to)->create($table, function(Blueprint $table_bp) use ($table, $columns) { |
|
214 | 214 | foreach ($columns as $column) { |
215 | 215 | $type = Schema::connection($this->from)->getColumnType($table, $column); |
216 | 216 | |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | |
224 | 224 | private function updateTable(string $table, string $column): void |
225 | 225 | { |
226 | - Schema::connection($this->to)->table($table, function (Blueprint $table_bp) use ($table, $column) { |
|
226 | + Schema::connection($this->to)->table($table, function(Blueprint $table_bp) use ($table, $column) { |
|
227 | 227 | $type = Schema::connection($this->from)->getColumnType($table, $column); |
228 | 228 | |
229 | 229 | $table_bp->{$type}($column)->nullable(); |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | if ($this->cli) { |
238 | 238 | $this->cli->{$type}($msg); |
239 | 239 | } else { |
240 | - echo PHP_EOL.$msg.PHP_EOL; |
|
240 | + echo PHP_EOL . $msg . PHP_EOL; |
|
241 | 241 | } |
242 | 242 | } |
243 | 243 | } |