| Conditions | 1 |
| Paths | 1 |
| Total Lines | 88 |
| Code Lines | 66 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 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 |
||
| 129 | public function getFieldsProvider() |
||
| 130 | { |
||
| 131 | return [ |
||
| 132 | [ |
||
| 133 | 'CREATE USER test', |
||
| 134 | [], |
||
| 135 | ], |
||
| 136 | [ |
||
| 137 | 'CREATE TABLE `address` ( |
||
| 138 | `address_id` smallint(5) unsigned NOT NULL AUTO_INCREMENT, |
||
| 139 | `address` varchar(50) NOT NULL, |
||
| 140 | `address2` varchar(50) DEFAULT NULL, |
||
| 141 | `district` varchar(20) NOT NULL, |
||
| 142 | `city_id` smallint(5) unsigned NOT NULL, |
||
| 143 | `postal_code` varchar(10) DEFAULT NULL, |
||
| 144 | `phone` varchar(20) NOT NULL, |
||
| 145 | `last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, |
||
| 146 | PRIMARY KEY (`address_id`), |
||
| 147 | KEY `idx_fk_city_id` (`city_id`), |
||
| 148 | CONSTRAINT `fk_address_city` FOREIGN KEY (`city_id`) REFERENCES `city` (`city_id`) ON UPDATE CASCADE |
||
| 149 | ) ENGINE=InnoDB AUTO_INCREMENT=606 DEFAULT CHARSET=utf8', |
||
| 150 | [ |
||
| 151 | 'address_id' => [ |
||
| 152 | 'type' => 'SMALLINT', |
||
| 153 | 'timestamp_not_null' => false, |
||
| 154 | ], |
||
| 155 | 'address' => [ |
||
| 156 | 'type' => 'VARCHAR', |
||
| 157 | 'timestamp_not_null' => false, |
||
| 158 | ], |
||
| 159 | 'address2' => [ |
||
| 160 | 'type' => 'VARCHAR', |
||
| 161 | 'timestamp_not_null' => false, |
||
| 162 | 'default_value' => 'NULL', |
||
| 163 | ], |
||
| 164 | 'district' => [ |
||
| 165 | 'type' => 'VARCHAR', |
||
| 166 | 'timestamp_not_null' => false, |
||
| 167 | ], |
||
| 168 | 'city_id' => [ |
||
| 169 | 'type' => 'SMALLINT', |
||
| 170 | 'timestamp_not_null' => false, |
||
| 171 | ], |
||
| 172 | 'postal_code' => [ |
||
| 173 | 'type' => 'VARCHAR', |
||
| 174 | 'timestamp_not_null' => false, |
||
| 175 | 'default_value' => 'NULL', |
||
| 176 | ], |
||
| 177 | 'phone' => [ |
||
| 178 | 'type' => 'VARCHAR', |
||
| 179 | 'timestamp_not_null' => false, |
||
| 180 | ], |
||
| 181 | 'last_update' => [ |
||
| 182 | 'type' => 'TIMESTAMP', |
||
| 183 | 'timestamp_not_null' => true, |
||
| 184 | 'default_value' => 'CURRENT_TIMESTAMP', |
||
| 185 | 'default_current_timestamp' => true, |
||
| 186 | 'on_update_current_timestamp' => true, |
||
| 187 | ], |
||
| 188 | ], |
||
| 189 | ], |
||
| 190 | [ |
||
| 191 | 'CREATE TABLE table1 ( |
||
| 192 | a INT NOT NULL, |
||
| 193 | b VARCHAR(32), |
||
| 194 | c INT AS (a mod 10) VIRTUAL, |
||
| 195 | d VARCHAR(5) AS (left(b,5)) PERSISTENT |
||
| 196 | )', |
||
| 197 | [ |
||
| 198 | 'a' => [ |
||
| 199 | 'type' => 'INT', |
||
| 200 | 'timestamp_not_null' => false, |
||
| 201 | ], |
||
| 202 | 'b' => [ |
||
| 203 | 'type' => 'VARCHAR', |
||
| 204 | 'timestamp_not_null' => false, |
||
| 205 | ], |
||
| 206 | 'c' => [ |
||
| 207 | 'type' => 'INT', |
||
| 208 | 'timestamp_not_null' => false, |
||
| 209 | 'generated' => true, |
||
| 210 | 'expr' => '(a mod 10)', |
||
| 211 | ], |
||
| 212 | 'd' => [ |
||
| 213 | 'type' => 'VARCHAR', |
||
| 214 | 'timestamp_not_null' => false, |
||
| 215 | 'generated' => true, |
||
| 216 | 'expr' => '(left(b,5))', |
||
| 217 | ], |
||
| 223 |