Conditions | 11 |
Paths | 2 |
Total Lines | 33 |
Code Lines | 20 |
Lines | 0 |
Ratio | 0 % |
Tests | 19 |
CRAP Score | 11.0151 |
Changes | 1 | ||
Bugs | 0 | Features | 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 |
||
59 | 13 | private function pageSetup(SimpleXMLElement $xmlX, array $namespaces, stdClass $printDefaults): stdClass |
|
60 | { |
||
61 | 13 | if (isset($xmlX->WorksheetOptions->PageSetup)) { |
|
62 | 12 | foreach ($xmlX->WorksheetOptions->PageSetup as $pageSetupData) { |
|
63 | 12 | foreach ($pageSetupData as $pageSetupKey => $pageSetupValue) { |
|
64 | 12 | $pageSetupAttributes = $pageSetupValue->attributes($namespaces['x']); |
|
1 ignored issue
–
show
|
|||
65 | 12 | if (!$pageSetupAttributes) { |
|
66 | continue; |
||
67 | } |
||
68 | |||
69 | switch ($pageSetupKey) { |
||
70 | 12 | case 'Layout': |
|
71 | 2 | $this->setLayout($printDefaults, $pageSetupAttributes); |
|
72 | |||
73 | 2 | break; |
|
74 | 12 | case 'Header': |
|
75 | 12 | $printDefaults->headerMargin = (float) $pageSetupAttributes->Margin ?: 1.0; |
|
76 | |||
77 | 12 | break; |
|
78 | 12 | case 'Footer': |
|
79 | 12 | $printDefaults->footerMargin = (float) $pageSetupAttributes->Margin ?: 1.0; |
|
80 | |||
81 | 12 | break; |
|
82 | 12 | case 'PageMargins': |
|
83 | 12 | $this->setMargins($printDefaults, $pageSetupAttributes); |
|
84 | |||
85 | 12 | break; |
|
86 | } |
||
87 | } |
||
88 | } |
||
89 | } |
||
90 | |||
91 | 13 | return $printDefaults; |
|
92 | } |
||
135 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.