Conditions | 13 |
Paths | 4096 |
Total Lines | 64 |
Code Lines | 38 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
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 |
||
96 | public function down(Schema $schema): void |
||
97 | { |
||
98 | |||
99 | $table = $schema->getTable('lti_external_tool'); |
||
100 | if ($table->hasColumn('title')) { |
||
101 | $this->addSql('ALTER TABLE lti_external_tool CHANGE title name VARCHAR(255) NOT NULL'); |
||
102 | } |
||
103 | |||
104 | $table = $schema->getTable('track_e_hotpotatoes'); |
||
105 | if ($table->hasColumn('title')) { |
||
106 | $this->addSql('ALTER TABLE track_e_hotpotatoes CHANGE title exe_name VARCHAR(255) NOT NULL'); |
||
107 | } |
||
108 | |||
109 | $table = $schema->getTable('resource_tag'); |
||
110 | if ($table->hasColumn('title')) { |
||
111 | $this->addSql('ALTER TABLE resource_tag CHANGE title name VARCHAR(255) NOT NULL'); |
||
112 | } |
||
113 | |||
114 | $table = $schema->getTable('tool'); |
||
115 | if ($table->hasIndex('UNIQ_20F33ED12B36786B')) { |
||
116 | $this->addSql( |
||
117 | 'DROP INDEX UNIQ_20F33ED12B36786B on tool' |
||
118 | ); |
||
119 | } |
||
120 | if ($table->hasColumn('title')) { |
||
121 | $this->addSql('ALTER TABLE tool CHANGE title name VARCHAR(255) NOT NULL'); |
||
122 | } |
||
123 | $this->addSql( |
||
124 | 'CREATE UNIQUE INDEX UNIQ_20F33ED15E237E06 ON tool (title)' |
||
125 | ); |
||
126 | |||
127 | $table = $schema->getTable('resource_format'); |
||
128 | if ($table->hasColumn('title')) { |
||
129 | $this->addSql('ALTER TABLE resource_format CHANGE title name VARCHAR(255) NOT NULL'); |
||
130 | } |
||
131 | |||
132 | $table = $schema->getTable('resource_type'); |
||
133 | if ($table->hasColumn('title')) { |
||
134 | $this->addSql('ALTER TABLE resource_type CHANGE title name VARCHAR(255) NOT NULL'); |
||
135 | } |
||
136 | |||
137 | $table = $schema->getTable('illustration'); |
||
138 | if ($table->hasColumn('title')) { |
||
139 | $this->addSql('ALTER TABLE illustration CHANGE title name VARCHAR(255) NOT NULL'); |
||
140 | } |
||
141 | |||
142 | $table = $schema->getTable('c_shortcut'); |
||
143 | if ($table->hasColumn('title')) { |
||
144 | $this->addSql('ALTER TABLE c_shortcut CHANGE title name VARCHAR(255) NOT NULL'); |
||
145 | } |
||
146 | |||
147 | $table = $schema->getTable('c_wiki_category'); |
||
148 | if ($table->hasColumn('title')) { |
||
149 | $this->addSql('ALTER TABLE c_wiki_category CHANGE title name VARCHAR(255) NOT NULL'); |
||
150 | } |
||
151 | |||
152 | $table = $schema->getTable('c_chat_conversation'); |
||
153 | if ($table->hasColumn('title')) { |
||
154 | $this->addSql('ALTER TABLE c_chat_conversation CHANGE title name VARCHAR(255) NOT NULL'); |
||
155 | } |
||
156 | |||
157 | $table = $schema->getTable('skill_level'); |
||
158 | if ($table->hasColumn('short_title')) { |
||
159 | $this->addSql('ALTER TABLE skill_level CHANGE short_title short_name VARCHAR(255) NOT NULL'); |
||
160 | } |
||
163 |