Conditions | 11 |
Paths | 384 |
Total Lines | 18 |
Code Lines | 13 |
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 |
||
36 | public function addField($indexField) { |
||
37 | $this->Key_name = isset($indexField['Key_name']) ? $indexField['Key_name'] : null; |
||
38 | $this->Non_unique = isset($indexField['Non_unique']) ? $indexField['Non_unique'] : null; |
||
39 | $this->Packed = isset($indexField['Packed']) ? $indexField['Packed'] : null; |
||
40 | $this->Index_type = isset($indexField['Index_type']) ? $indexField['Index_type'] : null; |
||
41 | $this->Comment = isset($indexField['Comment']) ? $indexField['Comment'] : null; |
||
42 | $this->Index_comment = isset($indexField['Index_comment']) ? $indexField['Index_comment'] : null; |
||
43 | $this->Visible = isset($indexField['Visible']) ? $indexField['Visible'] : null; |
||
44 | |||
45 | if (isset($indexField['Column_name']) || isset($indexField['Expression'])) { |
||
46 | $fullName = $indexField['Column_name'] . |
||
47 | (!empty($indexField['Expression']) ? '|' . $indexField['Expression'] : ''); |
||
48 | |||
49 | $this->fields[$fullName] = new DbIndexField($indexField); |
||
50 | $this->sorted = false; |
||
51 | } |
||
52 | |||
53 | return $this; |
||
54 | } |
||
75 |