@@ -45,11 +45,11 @@ |
||
45 | 45 | } |
46 | 46 | |
47 | 47 | if ($this->option('limit')) { |
48 | - $synchronizer->limit = (int) $this->option('limit'); |
|
48 | + $synchronizer->limit = (int)$this->option('limit'); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | $synchronizer->run(); |
52 | 52 | |
53 | - $this->info(PHP_EOL.'Synchronization done!'); |
|
53 | + $this->info(PHP_EOL . 'Synchronization done!'); |
|
54 | 54 | } |
55 | 55 | } |
@@ -25,7 +25,7 @@ |
||
25 | 25 | */ |
26 | 26 | public function register() |
27 | 27 | { |
28 | - $this->mergeConfigFrom(__DIR__.'/../config/database-synchronizer.php', 'database-synchronizer'); |
|
28 | + $this->mergeConfigFrom(__DIR__ . '/../config/database-synchronizer.php', 'database-synchronizer'); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | /** |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | public function run(): void |
58 | 58 | { |
59 | 59 | foreach ($this->getTables() as $table) { |
60 | - $this->feedback(PHP_EOL.PHP_EOL."Table: $table", 'line'); |
|
60 | + $this->feedback(PHP_EOL . PHP_EOL . "Table: $table", 'line'); |
|
61 | 61 | |
62 | 62 | $this->syncTable($table); |
63 | 63 | $this->syncRows($table); |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | $builder = $this->fromDB->table($table); |
107 | 107 | $statement = $pdo->prepare($builder->toSql()); |
108 | 108 | |
109 | - if (! $statement instanceof \PDOStatement) { |
|
109 | + if (!$statement instanceof \PDOStatement) { |
|
110 | 110 | return; |
111 | 111 | } |
112 | 112 | |
@@ -125,10 +125,10 @@ discard block |
||
125 | 125 | while ($row = $statement->fetch(\PDO::FETCH_OBJ)) { |
126 | 126 | $exists = $this->getToDb()->table($table)->where($queryColumn, $row->{$queryColumn})->first(); |
127 | 127 | |
128 | - if (! $exists) { |
|
129 | - $this->getToDb()->table($table)->insert((array) $row); |
|
128 | + if (!$exists) { |
|
129 | + $this->getToDb()->table($table)->insert((array)$row); |
|
130 | 130 | } else { |
131 | - $this->getToDb()->table($table)->where($queryColumn, $row->{$queryColumn})->update((array) $row); |
|
131 | + $this->getToDb()->table($table)->where($queryColumn, $row->{$queryColumn})->update((array)$row); |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | if (isset($bar)) { |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | |
144 | 144 | public function getTables(): array |
145 | 145 | { |
146 | - if (! empty($this->tables)) { |
|
146 | + if (!empty($this->tables)) { |
|
147 | 147 | return $this->tables; |
148 | 148 | } |
149 | 149 | |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | { |
155 | 155 | $this->feedback("Creating '$this->to.$table' table", 'warn'); |
156 | 156 | |
157 | - Schema::connection($this->to)->create($table, function (Blueprint $table_bp) use ($table, $columns) { |
|
157 | + Schema::connection($this->to)->create($table, function(Blueprint $table_bp) use ($table, $columns) { |
|
158 | 158 | foreach ($columns as $column) { |
159 | 159 | $type = Schema::connection($this->from)->getColumnType($table, $column); |
160 | 160 | |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | |
168 | 168 | private function updateTable(string $table, string $column): void |
169 | 169 | { |
170 | - Schema::connection($this->to)->table($table, function (Blueprint $table_bp) use ($table, $column) { |
|
170 | + Schema::connection($this->to)->table($table, function(Blueprint $table_bp) use ($table, $column) { |
|
171 | 171 | $type = Schema::connection($this->from)->getColumnType($table, $column); |
172 | 172 | |
173 | 173 | $table_bp->{$type}($column)->nullable(); |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | if ($this->cli) { |
182 | 182 | $this->cli->{$type}($msg); |
183 | 183 | } else { |
184 | - echo PHP_EOL.$msg.PHP_EOL; |
|
184 | + echo PHP_EOL . $msg . PHP_EOL; |
|
185 | 185 | } |
186 | 186 | } |
187 | 187 | } |