| Conditions | 10 |
| Paths | 14 |
| Total Lines | 15 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 5 |
| CRAP Score | 29.8461 |
| 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 |
||
| 7 | 13 | public static function getColonneLink($paricevuti, &$modellocolonne) |
|
| 8 | { |
||
| 9 | 13 | $output = GrigliaParametriUtils::getOuputType($paricevuti); |
|
|
|
|||
| 10 | 13 | $colonne_link = isset($paricevuti['colonne_link']) ? $paricevuti['colonne_link'] : array(); |
|
| 11 | 13 | if (($output == 'stampa') || !isset($colonne_link)) { |
|
| 12 | return; |
||
| 13 | } |
||
| 14 | |||
| 15 | 13 | foreach ($colonne_link as $colonna_link) { |
|
| 16 | foreach ($colonna_link as $nomecolonna => $parametricolonna) { |
||
| 17 | foreach ($modellocolonne as $key => $value) { |
||
| 18 | foreach ($value as $keyv => $valuev) { |
||
| 19 | if (($keyv == 'name') && ($valuev == $nomecolonna)) { |
||
| 20 | $modellocolonne[$key]['formatter'] = 'showlink'; |
||
| 21 | $modellocolonne[$key]['formatoptions'] = $parametricolonna; |
||
| 22 | } |
||
| 29 |
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.
To visualize
will produce issues in the first and second line, while this second example
will produce no issues.