| Conditions | 7 |
| Paths | 5 |
| Total Lines | 27 |
| Code Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 18 |
| CRAP Score | 7 |
| Changes | 2 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 20 | 2 | protected function removeInvalidChildren(LoggerInterface $logger) |
|
| 21 | { |
||
| 22 | 2 | $encounteredImgElement = false; |
|
| 23 | 2 | foreach ($this->children as $child) { |
|
| 24 | 2 | if ($child instanceof NonParticipating || |
|
| 25 | 2 | $child instanceof Source || |
|
| 26 | 2 | $child instanceof ScriptSupporting) { |
|
| 27 | 1 | continue; |
|
| 28 | } |
||
| 29 | |||
| 30 | 2 | if ($child instanceof Img) { |
|
| 31 | 2 | if ($encounteredImgElement) { |
|
| 32 | 1 | $logger->debug('Removing ' . $child . '. Only one "img" element allowed as child of "picture" element.'); |
|
| 33 | 1 | $this->removeChild($child); |
|
| 34 | |||
| 35 | 1 | continue; |
|
| 36 | } |
||
| 37 | |||
| 38 | 2 | $encounteredImgElement = true; |
|
| 39 | |||
| 40 | 2 | continue; |
|
| 41 | } |
||
| 42 | |||
| 43 | 1 | $logger->debug('Removing ' . $child . '. Only one "img" element and zero to many "source" elements allowed as children of the "picture" element.'); |
|
| 44 | 1 | $this->removeChild($child); |
|
| 45 | 2 | } |
|
| 46 | 2 | } |
|
| 47 | } |
||
| 48 |