| Conditions | 15 |
| Paths | 9216 |
| Total Lines | 68 |
| Code Lines | 39 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 146 | public function down(Schema $schema): void |
||
| 147 | { |
||
| 148 | if ($schema->hasTable('c_wiki_category')) { |
||
| 149 | $this->addSql( |
||
| 150 | 'DROP TABLE c_wiki_category' |
||
| 151 | ); |
||
| 152 | } |
||
| 153 | |||
| 154 | if ($schema->hasTable('c_wiki_rel_category')) { |
||
| 155 | $this->addSql( |
||
| 156 | 'DROP TABLE c_wiki_rel_category' |
||
| 157 | ); |
||
| 158 | } |
||
| 159 | |||
| 160 | if ($schema->hasTable('c_lp_item')) { |
||
| 161 | $table = $schema->getTable('c_lp_item'); |
||
| 162 | if ($table->hasColumn('item_root')) { |
||
| 163 | $this->addSql( |
||
| 164 | 'ALTER TABLE c_lp_item CHANGE item_root c_id INT DEFAULT NULL' |
||
| 165 | ); |
||
| 166 | } |
||
| 167 | } |
||
| 168 | |||
| 169 | $table = $schema->getTable('c_lp'); |
||
| 170 | if ($table->hasColumn('next_lp_id')) { |
||
| 171 | $this->addSql('ALTER TABLE c_lp DROP next_lp_id'); |
||
| 172 | } |
||
| 173 | |||
| 174 | if ($schema->hasTable('c_lp')) { |
||
| 175 | $table = $schema->getTable('c_lp'); |
||
| 176 | if ($table->hasColumn('published_on')) { |
||
| 177 | $this->addSql( |
||
| 178 | 'ALTER TABLE c_lp CHANGE published_on publicated_on datetime NULL;' |
||
| 179 | ); |
||
| 180 | } |
||
| 181 | } |
||
| 182 | $table = $schema->getTable('c_attendance_sheet'); |
||
| 183 | if ($table->hasColumn('signature')) { |
||
| 184 | $this->addSql('ALTER TABLE c_attendance_sheet DROP signature'); |
||
| 185 | } |
||
| 186 | |||
| 187 | $table = $schema->getTable('c_attendance_calendar'); |
||
| 188 | if ($table->hasColumn('blocked')) { |
||
| 189 | $this->addSql('ALTER TABLE c_attendance_calendar DROP blocked'); |
||
| 190 | } |
||
| 191 | |||
| 192 | $table = $schema->getTable('c_quiz'); |
||
| 193 | if ($table->hasColumn('hide_attempts_table')) { |
||
| 194 | $this->addSql('ALTER TABLE c_quiz DROP hide_attempts_table'); |
||
| 195 | } |
||
| 196 | |||
| 197 | $table = $schema->getTable('c_survey_answer'); |
||
| 198 | if ($table->hasColumn('session_id')) { |
||
| 199 | $this->addSql('ALTER TABLE c_survey_answer DROP session_id'); |
||
| 200 | } |
||
| 201 | |||
| 202 | if ($table->hasColumn('c_lp_item_id')) { |
||
| 203 | $this->addSql('ALTER TABLE c_survey_answer DROP c_lp_item_id'); |
||
| 204 | } |
||
| 205 | |||
| 206 | $table = $schema->getTable('c_survey_invitation'); |
||
| 207 | if ($table->hasColumn('c_lp_item_id')) { |
||
| 208 | $this->addSql('ALTER TABLE c_survey_invitation DROP c_lp_item_id'); |
||
| 209 | } |
||
| 210 | |||
| 211 | $table = $schema->getTable('gradebook_category'); |
||
| 212 | if ($table->hasColumn('allow_skills_by_subcategory')) { |
||
| 213 | $this->addSql('ALTER TABLE gradebook_category DROP allow_skills_by_subcategory'); |
||
| 214 | } |
||
| 217 |