| Conditions | 18 |
| Paths | 18 |
| Total Lines | 23 |
| Code Lines | 21 |
| 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 |
||
| 37 | public function getFormInputClass(Column $column) |
||
| 38 | { |
||
| 39 | switch ($column->getType()->getName()) { |
||
| 40 | case 'text': |
||
| 41 | return new TextArea($column); |
||
| 42 | case 'integer': |
||
| 43 | case 'int': |
||
| 44 | case 'mediumint': |
||
| 45 | case 'bigint': |
||
| 46 | case 'decimal': |
||
| 47 | case 'float': |
||
| 48 | case 'double': |
||
| 49 | case 'enum': |
||
| 50 | case 'date': |
||
| 51 | case 'datetime': |
||
| 52 | case 'timestamp': |
||
| 53 | case 'time': |
||
| 54 | case 'bool': |
||
| 55 | case 'year': |
||
| 56 | case 'boolean': |
||
| 57 | case 'varchat': |
||
| 58 | default: |
||
| 59 | return new Input($column); |
||
| 60 | } |
||
| 134 |