| Conditions | 10 |
| Paths | 10 |
| Total Lines | 25 |
| Code Lines | 22 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 110 |
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 |
||
| 19 | public static function getTypeName($type) |
||
| 20 | { |
||
| 21 | switch ($type) { |
||
| 22 | case CompiledExpression::INTEGER: |
||
| 23 | return 'integer'; |
||
| 24 | case CompiledExpression::DOUBLE: |
||
| 25 | return 'double'; |
||
| 26 | case CompiledExpression::NUMBER: |
||
| 27 | return 'number'; |
||
| 28 | case CompiledExpression::ARR: |
||
| 29 | return 'array'; |
||
| 30 | case CompiledExpression::OBJECT: |
||
| 31 | return 'object'; |
||
| 32 | case CompiledExpression::RESOURCE: |
||
| 33 | return 'resource'; |
||
| 34 | case CompiledExpression::CALLABLE_TYPE: |
||
| 35 | return 'callable'; |
||
| 36 | case CompiledExpression::BOOLEAN: |
||
| 37 | return 'boolean'; |
||
| 38 | case CompiledExpression::NULL: |
||
| 39 | return 'null'; |
||
| 40 | default: |
||
| 41 | return 'uknown'; |
||
| 42 | } |
||
| 43 | } |
||
| 44 | |||
| 92 |