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