| Conditions | 10 |
| Paths | 3 |
| Total Lines | 18 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 14 |
| CRAP Score | 10 |
| 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 |
||
| 21 | 6 | protected function removeInvalidChildren(LoggerInterface $logger) |
|
| 22 | { |
||
| 23 | 6 | foreach ($this->children as $child) { |
|
| 24 | 6 | if ($child instanceof NonParticipating || |
|
| 25 | 6 | $child instanceof Caption || |
|
| 26 | 6 | $child instanceof Colgroup || |
|
| 27 | 6 | $child instanceof Thead || |
|
| 28 | 6 | $child instanceof Tbody || |
|
| 29 | 6 | $child instanceof Tr || |
|
| 30 | 4 | $child instanceof Tfoot || |
|
| 31 | 6 | $child instanceof ScriptSupporting) { |
|
| 32 | 6 | continue; |
|
| 33 | } |
||
| 34 | |||
| 35 | 1 | $logger->debug('Removing ' . $child . '. Only "caption", "colgroup", "thead", "tbody", "tr", "tfoot", and script supporting elements allowed as children of "table" element.'); |
|
| 36 | 1 | $this->removeChild($child); |
|
| 37 | } |
||
| 38 | 6 | } |
|
| 39 | } |
||
| 40 |