| Conditions | 10 |
| Paths | 10 |
| Total Lines | 29 |
| Code Lines | 22 |
| 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 |
||
| 71 | private function getLineItem($child3): array |
||
| 72 | { |
||
| 73 | $arrayOutput = []; |
||
| 74 | foreach ($this->arraySettings['CustomOrder']['Lines_Item@Read'] as $key => $value) { |
||
| 75 | switch ($value) { |
||
| 76 | case 'MultipleAggregate': |
||
| 77 | $intLineNo = 0; |
||
| 78 | foreach ($child3->children('cac', true)->$key as $value2) { |
||
| 79 | $intLineNo++; |
||
| 80 | $intLineStr = ($intLineNo < 10 ? '0' : '') . $intLineNo; |
||
| 81 | $arrayOutput[$key][$intLineStr] = $this->getElements($value2); |
||
| 82 | } |
||
| 83 | break; |
||
| 84 | case 'SingleAggregate': |
||
| 85 | if (count($child3->children('cac', true)->$key) !== 0) { |
||
| 86 | $arrayOutput[$key] = $this->getElements($child3->children('cac', true)->$key); |
||
| 87 | } |
||
| 88 | break; |
||
| 89 | case 'SingleBasic': |
||
| 90 | if (count($child3->children('cbc', true)->$key) !== 0) { |
||
| 91 | $arrayOutput[$key] = $child3->children('cbc', true)->$key->__toString(); |
||
| 92 | } |
||
| 93 | break; |
||
| 94 | case 'TaxCategory': |
||
| 95 | $arrayOutput[$key] = $this->getTaxCategory($child3->children('cac', true)->$key); |
||
| 96 | break; |
||
| 97 | } |
||
| 98 | } |
||
| 99 | return $arrayOutput; |
||
| 100 | } |
||
| 102 |