Conditions | 8 |
Paths | 6 |
Total Lines | 31 |
Code Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 72 |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
19 | protected function doClean(LoggerInterface $logger) |
||
20 | { |
||
21 | // No HeadingContent descendants |
||
22 | // No SectioningContent descendants |
||
23 | // No "header", "footer", or "address" element descendants. |
||
|
|||
24 | foreach ($this->children as $child) { |
||
25 | if ($child instanceof HeadingContent) { |
||
26 | $logger->debug('Heading Content elements not allowed as "address" element child.'); |
||
27 | |||
28 | return false; |
||
29 | } |
||
30 | |||
31 | if ($child instanceof SectioningContent) { |
||
32 | $logger->debug('Sectioning Content elements not allowed as "address" element child.'); |
||
33 | |||
34 | return false; |
||
35 | } |
||
36 | |||
37 | if ($child->getType() == Token::ELEMENT) { |
||
38 | if ($child->getName() == 'header' || |
||
39 | $child->getName() == 'footer' || |
||
40 | $child->getName() == 'address') { |
||
41 | $logger->debug('Elements "header", "footer", and "address" not allowed as "address" element child.'); |
||
42 | |||
43 | return false; |
||
44 | } |
||
45 | } |
||
46 | } |
||
47 | |||
48 | return true; |
||
49 | } |
||
50 | } |
||
51 |
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.