Conditions | 7 |
Paths | 2 |
Total Lines | 27 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Tests | 16 |
CRAP Score | 7 |
Changes | 2 | ||
Bugs | 1 | Features | 2 |
1 | <?php |
||
19 | 1 | protected function doClean(LoggerInterface $logger) |
|
20 | { |
||
21 | 1 | if ($this->configuration->get('clean-strategy') != Configuration::CLEAN_STRATEGY_LENIENT) { |
|
22 | // Only "li" and ScriptSupporting elements allowed. |
||
23 | 1 | foreach ($this->children as $child) { |
|
24 | 1 | if ($child->getType() == Token::COMMENT) { |
|
25 | 1 | continue; |
|
26 | } |
||
27 | |||
28 | 1 | if ($child->getType() != Token::ELEMENT) { |
|
29 | 1 | $logger->debug('Removing ' . $child . '. Only elements "li" and script supporting elements allowed as children of "ul" element.'); |
|
30 | 1 | $this->removeChild($child); |
|
31 | |||
32 | 1 | continue; |
|
33 | } |
||
34 | |||
35 | 1 | if ($child->getName() == 'li' || $child instanceof ScriptSupporting) { |
|
36 | 1 | continue; |
|
37 | } |
||
38 | |||
39 | 1 | $logger->debug('Removing ' . $child . '. Only elements "li" and script supporting elements allowed as children of "ul" element.'); |
|
40 | 1 | $this->removeChild($child); |
|
41 | 1 | } |
|
42 | 1 | } |
|
43 | |||
44 | 1 | return true; |
|
45 | } |
||
46 | } |