Passed
Pull Request — master (#5)
by Abdelouahab
03:23
created
src/Column.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 
22 22
     public function create($line, $column)
23 23
     {
24
-        LaravelSchema::table($this->schema->name, function (Blueprint $table) use ($line) {
24
+        LaravelSchema::table($this->schema->name, function(Blueprint $table) use ($line) {
25 25
             eval($line . ';');
26 26
         });
27 27
 
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 
31 31
     public function delete($column)
32 32
     {
33
-        LaravelSchema::table($this->schema->name, function (Blueprint $table) use ($column) {
33
+        LaravelSchema::table($this->schema->name, function(Blueprint $table) use ($column) {
34 34
             $table->dropColumn($column);
35 35
         });
36 36
 
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
     {
42 42
         $renameTo = $this->schema->output()->choice('Rename to ? :', $this->schema->schemaUnsyncedColumnsOutput(), 0);
43 43
 
44
-        LaravelSchema::table($this->schema->name, function (Blueprint $table) use ($column, $renameTo) {
44
+        LaravelSchema::table($this->schema->name, function(Blueprint $table) use ($column, $renameTo) {
45 45
             $table->renameColumn($column, $renameTo);
46 46
         });
47 47
 
Please login to merge, or discard this patch.
src/SyncMigrationServiceProvider.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
      */
14 14
     public function register()
15 15
     {
16
-        $this->app->singleton('command.devMigrateCommand', function ($app) {
16
+        $this->app->singleton('command.devMigrateCommand', function($app) {
17 17
             return new SyncMigrateCommand($app['migrator']);
18 18
         });
19 19
 
Please login to merge, or discard this patch.
src/SyncMigrateCommand.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
             $this->processMigration(file_get_contents($file));
59 59
         }
60 60
 
61
-        $this->abondedTables()->each(function ($table) {
61
+        $this->abondedTables()->each(function($table) {
62 62
             $this->error("Schemas doesn't have table <fg=black;bg=white> {$table} </> seems you have delete it");
63 63
 
64 64
             $this->confirm("Do you want to drop <fg=black;bg=white> {$table} </> ?",
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 
75 75
     protected function tables()
76 76
     {
77
-        return collect(DB::select('SHOW TABLES'))->map(function ($table) {
77
+        return collect(DB::select('SHOW TABLES'))->map(function($table) {
78 78
             return array_values((array)$table);
79 79
         })->flatten();
80 80
     }
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 
106 106
     protected function schemasTables()
107 107
     {
108
-        return $this->schemas->pluck('name')->push('migrations')->map(function ($name) {
108
+        return $this->schemas->pluck('name')->push('migrations')->map(function($name) {
109 109
             return DB::getTablePrefix() . $name;
110 110
         });
111 111
     }
Please login to merge, or discard this patch.
src/Schema.php 1 patch
Spacing   +12 added lines, -13 removed lines patch added patch discarded remove patch
@@ -44,11 +44,11 @@  discard block
 block discarded – undo
44 44
 
45 45
     protected function create()
46 46
     {
47
-        if($this->columnsList()->isEmpty()) {
47
+        if ($this->columnsList()->isEmpty()) {
48 48
             return $this->output()->error("Table <fg=black;bg=white> {$this->table} </> does not have any columns");
49 49
         }
50 50
 
51
-        LaravelSchema::create($this->name, function (Blueprint $table) {
51
+        LaravelSchema::create($this->name, function(Blueprint $table) {
52 52
             eval($this->schema->group(2));
53 53
         });
54 54
 
@@ -57,18 +57,18 @@  discard block
 block discarded – undo
57 57
 
58 58
     protected function sync()
59 59
     {
60
-        if($this->schemaEmpty()) {
60
+        if ($this->schemaEmpty()) {
61 61
             return $this->dropSchema();
62 62
         }
63 63
 
64
-        $this->dbUnsyncedColumns()->each(function ($type, $column)  {
64
+        $this->dbUnsyncedColumns()->each(function($type, $column) {
65 65
             $this->output()->info("Column <fg=black;bg=yellow> {$this->table}->{$column} </> is renamed or deleted !!");
66 66
             $action = $this->output()->choice('What we should do ?', $this->syncChoices(), 0);
67 67
 
68 68
             (new Column($this))->$action($column);
69 69
         });
70 70
 
71
-        $this->schemaUnsyncedColumns()->each(function ($column, $line) {
71
+        $this->schemaUnsyncedColumns()->each(function($column, $line) {
72 72
             (new Column($this))->create($line, $column);
73 73
         });
74 74
     }
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
     protected function getName($name)
89 89
     {
90 90
         //TODO: https://github.com/awssat/laravel-sync-migration/issues/2
91
-        if(preg_match('/[\'|"]\s?\.\s?\$/', $name) || preg_match('/\$[a-zA-z0-9-_]+\s?\.\s?[\'|"]/', $name)) {
91
+        if (preg_match('/[\'|"]\s?\.\s?\$/', $name) || preg_match('/\$[a-zA-z0-9-_]+\s?\.\s?[\'|"]/', $name)) {
92 92
             $this->output()->error("Using variables as table names (<fg=black;bg=white> {$name} </>) is not supported currentlly, see <href=https://github.com/awssat/laravel-sync-migration/issues/2> issue#2 </>");
93 93
             exit;
94 94
         }
@@ -103,38 +103,37 @@  discard block
 block discarded – undo
103 103
 
104 104
     protected function dbUnsyncedColumns()
105 105
     {
106
-        return $this->dbColumns()->reject(function ($type, $column) {
106
+        return $this->dbColumns()->reject(function($type, $column) {
107 107
             return $this->columnsList()->values()->flatten()->contains($column);
108 108
         });
109 109
     }
110 110
 
111 111
     protected function schemaUnsyncedColumns()
112 112
     {
113
-        return $this->columnsList()->reject(function ($column) {
113
+        return $this->columnsList()->reject(function($column) {
114 114
             return $this->dbColumns()->has($column);
115 115
         });
116 116
     }
117 117
 
118 118
     protected function syncChoices()
119 119
     {
120
-        return $this->schemaUnsyncedColumns()->isEmpty() ? ['Delete', 'Ignore'] :
121
-            ['Delete', 'Rename', 'Ignore'];
120
+        return $this->schemaUnsyncedColumns()->isEmpty() ? ['Delete', 'Ignore'] : ['Delete', 'Rename', 'Ignore'];
122 121
     }
123 122
 
124 123
     protected function dbColumns()
125 124
     {
126 125
         return collect(DB::select('DESCRIBE ' . $this->table))
127
-            ->mapWithKeys(function ($column) {
126
+            ->mapWithKeys(function($column) {
128 127
             return [$column->Field => $column->Type];
129 128
         });
130 129
     }
131 130
 
132 131
     protected function columnsList()
133 132
     {
134
-        return collect(explode(';', $this->schema->group(2)))->mapWithKeys(function ($line) {
133
+        return collect(explode(';', $this->schema->group(2)))->mapWithKeys(function($line) {
135 134
             $line = trim($line);
136 135
 
137
-            if(starts_with($line, ['//', '#', '/*'])) {
136
+            if (starts_with($line, ['//', '#', '/*'])) {
138 137
                 return [];
139 138
             }
140 139
 
Please login to merge, or discard this patch.