| Conditions | 11 |
| Paths | 11 |
| Total Lines | 28 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 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 |
||
| 54 | public static function preProcessing(Compiler $compiler, array $params, $prepend, $append, $type) |
||
| 55 | { |
||
| 56 | $params = $compiler->getCompiledParams($params); |
||
| 57 | switch (strtolower(trim((string)$params['enabled'], '"\''))) { |
||
| 58 | |||
| 59 | case 'on': |
||
| 60 | case 'true': |
||
| 61 | case 'enabled': |
||
| 62 | case 'enable': |
||
| 63 | case '1': |
||
| 64 | $enable = true; |
||
| 65 | break; |
||
| 66 | case 'off': |
||
| 67 | case 'false': |
||
| 68 | case 'disabled': |
||
| 69 | case 'disable': |
||
| 70 | case '0': |
||
| 71 | $enable = false; |
||
| 72 | break; |
||
| 73 | default: |
||
| 74 | throw new CompilationException($compiler, 'Auto_Escape : Invalid parameter (' . $params['enabled'] . '), valid parameters are "enable"/true or "disable"/false'); |
||
| 75 | } |
||
| 76 | |||
| 77 | self::$stack[] = $compiler->getAutoEscape(); |
||
| 78 | $compiler->setAutoEscape($enable); |
||
| 79 | |||
| 80 | return ''; |
||
| 81 | } |
||
| 82 | |||
| 99 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.