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 |
||
85 | private function getLineItem(\SimpleXMLElement $child3): array |
||
86 | { |
||
87 | $arrayOutput = []; |
||
88 | foreach ($this->arraySettings['CustomOrder']['Lines_Item@Read'] as $key => $value) { |
||
89 | switch ($value) { |
||
90 | case 'MultipleAggregate': |
||
91 | $intLineNo = 0; |
||
92 | foreach ($child3->children('cac', true)->$key as $value2) { |
||
93 | $intLineNo++; |
||
94 | $intLineStr = ($intLineNo < 10 ? '0' : '') . $intLineNo; |
||
95 | $arrayOutput[$key][$intLineStr] = $this->getElements($value2); |
||
96 | } |
||
97 | break; |
||
98 | case 'SingleAggregate': |
||
99 | if (count($child3->children('cac', true)->$key) !== 0) { |
||
100 | $arrayOutput[$key] = $this->getElements($child3->children('cac', true)->$key); |
||
101 | } |
||
102 | break; |
||
103 | case 'SingleBasic': |
||
104 | if (count($child3->children('cbc', true)->$key) !== 0) { |
||
105 | $arrayOutput[$key] = $child3->children('cbc', true)->$key->__toString(); |
||
106 | } |
||
107 | break; |
||
108 | case 'TaxCategory': |
||
109 | $arrayOutput[$key] = $this->getTaxCategory($child3->children('cac', true)->$key); |
||
110 | break; |
||
111 | } |
||
112 | } |
||
113 | return $arrayOutput; |
||
114 | } |
||
116 |