Conditions | 1 |
Paths | 1 |
Total Lines | 22 |
Code Lines | 15 |
Lines | 22 |
Ratio | 100 % |
Changes | 0 |
1 | <?php |
||
35 | public function down() |
||
36 | { |
||
37 | $teamsTable = $this->table('teams'); |
||
38 | $teamsTable |
||
39 | ->addColumn('status', 'set', [ |
||
40 | 'values' => ['open', 'closed', 'disabled', 'deleted'], |
||
41 | 'null' => false, |
||
42 | 'default' => 'open', |
||
43 | 'comment' => 'The status of the team', |
||
44 | ]) |
||
45 | ->update() |
||
46 | ; |
||
47 | |||
48 | $this->query("UPDATE teams SET status = 'deleted' WHERE is_deleted = 1;"); |
||
49 | $this->query("UPDATE teams SET status = 'closed' WHERE is_closed = 1;"); |
||
50 | |||
51 | $teamsTable |
||
52 | ->removeColumn('is_closed') |
||
53 | ->removeColumn('is_deleted') |
||
54 | ->update() |
||
55 | ; |
||
56 | } |
||
57 | } |
||
58 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.