Passed
Pull Request — master (#6)
by Abdelouahab
02:51
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
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
             $this->processMigration(file_get_contents($file));
60 60
         }
61 61
 
62
-        $this->abondedTables()->each(function ($table) {
62
+        $this->abondedTables()->each(function($table) {
63 63
             $this->error("Schemas doesn't have table <fg=black;bg=white> {$table} </> seems you have delete it");
64 64
 
65 65
             $this->confirm("Do you want to drop <fg=black;bg=white> {$table} </> ?",
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 
76 76
     protected function tables()
77 77
     {
78
-        return Collection::make(DB::select('SHOW TABLES'))->map(function ($table) {
78
+        return Collection::make(DB::select('SHOW TABLES'))->map(function($table) {
79 79
             return array_values((array)$table);
80 80
         })->flatten();
81 81
     }
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 
107 107
     protected function schemasTables()
108 108
     {
109
-        return $this->schemas->pluck('name')->push('migrations')->map(function ($name) {
109
+        return $this->schemas->pluck('name')->push('migrations')->map(function($name) {
110 110
             return DB::getTablePrefix() . $name;
111 111
         });
112 112
     }
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
@@ -46,11 +46,11 @@  discard block
 block discarded – undo
46 46
 
47 47
     protected function create()
48 48
     {
49
-        if($this->columnsList()->isEmpty()) {
49
+        if ($this->columnsList()->isEmpty()) {
50 50
             return $this->output()->error("Table <fg=black;bg=white> {$this->table} </> does not have any columns");
51 51
         }
52 52
 
53
-        LaravelSchema::create($this->name, function (Blueprint $table) {
53
+        LaravelSchema::create($this->name, function(Blueprint $table) {
54 54
             eval($this->schema->group(2));
55 55
         });
56 56
 
@@ -59,18 +59,18 @@  discard block
 block discarded – undo
59 59
 
60 60
     protected function sync()
61 61
     {
62
-        if($this->schemaEmpty()) {
62
+        if ($this->schemaEmpty()) {
63 63
             return $this->dropSchema();
64 64
         }
65 65
 
66
-        $this->dbUnsyncedColumns()->each(function ($type, $column)  {
66
+        $this->dbUnsyncedColumns()->each(function($type, $column) {
67 67
             $this->output()->info("Column <fg=black;bg=yellow> {$this->table}->{$column} </> is renamed or deleted !!");
68 68
             $action = $this->output()->choice('What we should do ?', $this->syncChoices(), 0);
69 69
 
70 70
             (new Column($this))->$action($column);
71 71
         });
72 72
 
73
-        $this->schemaUnsyncedColumns()->each(function ($column, $line) {
73
+        $this->schemaUnsyncedColumns()->each(function($column, $line) {
74 74
             (new Column($this))->create($line, $column);
75 75
         });
76 76
     }
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
     protected function getName($name)
91 91
     {
92 92
         //TODO: https://github.com/awssat/laravel-sync-migration/issues/2
93
-        if(preg_match('/[\'|"]\s?\.\s?\$/', $name) || preg_match('/\$[a-zA-z0-9-_]+\s?\.\s?[\'|"]/', $name)) {
93
+        if (preg_match('/[\'|"]\s?\.\s?\$/', $name) || preg_match('/\$[a-zA-z0-9-_]+\s?\.\s?[\'|"]/', $name)) {
94 94
             $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 </>");
95 95
             exit;
96 96
         }
@@ -105,38 +105,37 @@  discard block
 block discarded – undo
105 105
 
106 106
     protected function dbUnsyncedColumns()
107 107
     {
108
-        return $this->dbColumns()->reject(function ($type, $column) {
108
+        return $this->dbColumns()->reject(function($type, $column) {
109 109
             return $this->columnsList()->values()->flatten()->contains($column);
110 110
         });
111 111
     }
112 112
 
113 113
     protected function schemaUnsyncedColumns()
114 114
     {
115
-        return $this->columnsList()->reject(function ($column) {
115
+        return $this->columnsList()->reject(function($column) {
116 116
             return $this->dbColumns()->has($column);
117 117
         });
118 118
     }
119 119
 
120 120
     protected function syncChoices()
121 121
     {
122
-        return $this->schemaUnsyncedColumns()->isEmpty() ? ['Delete', 'Ignore'] :
123
-            ['Delete', 'Rename', 'Ignore'];
122
+        return $this->schemaUnsyncedColumns()->isEmpty() ? ['Delete', 'Ignore'] : ['Delete', 'Rename', 'Ignore'];
124 123
     }
125 124
 
126 125
     protected function dbColumns()
127 126
     {
128 127
         return Collection::make(DB::select('DESCRIBE ' . $this->table))
129
-            ->mapWithKeys(function ($column) {
128
+            ->mapWithKeys(function($column) {
130 129
             return [$column->Field => $column->Type];
131 130
         });
132 131
     }
133 132
 
134 133
     protected function columnsList()
135 134
     {
136
-        return Collection::make(explode(';', $this->schema->group(2)))->mapWithKeys(function ($line) {
135
+        return Collection::make(explode(';', $this->schema->group(2)))->mapWithKeys(function($line) {
137 136
             $line = trim($line);
138 137
 
139
-            if(Str::startsWith($line, ['//', '#', '/*'])) {
138
+            if (Str::startsWith($line, ['//', '#', '/*'])) {
140 139
                 return [];
141 140
             }
142 141
 
Please login to merge, or discard this patch.