Passed
Pull Request — master (#26)
by Maarten
02:58
created
src/Commands/Synchronise.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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()
Please login to merge, or discard this patch.
src/DatabaseSynchronizer.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
src/DatabaseSynchronizerServiceProvider.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
         }
19 19
 
20 20
         $this->publishes([
21
-            __DIR__.'/../config/database-synchronizer.php' => config_path('database-synchronizer.php'),
21
+            __DIR__ . '/../config/database-synchronizer.php' => config_path('database-synchronizer.php'),
22 22
         ]);
23 23
     }
24 24
 
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
      */
30 30
     public function register()
31 31
     {
32
-        $this->mergeConfigFrom(__DIR__.'/../config/database-synchronizer.php', 'database-synchronizer');
32
+        $this->mergeConfigFrom(__DIR__ . '/../config/database-synchronizer.php', 'database-synchronizer');
33 33
     }
34 34
 
35 35
     /**
Please login to merge, or discard this patch.