| Conditions | 9 |
| Paths | 3 |
| Total Lines | 36 |
| Code Lines | 19 |
| Lines | 36 |
| Ratio | 100 % |
| Tests | 21 |
| CRAP Score | 9 |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 18 | 3 | protected function removeInvalidChildren(LoggerInterface $logger) |
|
| 19 | { |
||
| 20 | // Children can be "tr" and script supporting elements. |
||
| 21 | 3 | foreach ($this->children as $child) { |
|
| 22 | 3 | if ($child->getType() == Token::COMMENT) { |
|
| 23 | 1 | continue; |
|
| 24 | } |
||
| 25 | |||
| 26 | 3 | if ($child->getType() !== Token::ELEMENT) { |
|
| 27 | 1 | $logger->debug('Removing ' . $child . '. Only elements allowed as children of "thead" element.'); |
|
| 28 | 1 | $this->removeChild($child); |
|
| 29 | |||
| 30 | 1 | continue; |
|
| 31 | } |
||
| 32 | |||
| 33 | 2 | if ($child->getName() == 'tr' || |
|
| 34 | 2 | $child instanceof ScriptSupporting) { |
|
| 35 | 1 | continue; |
|
| 36 | } |
||
| 37 | |||
| 38 | 1 | $logger->debug('Removing ' . $child . '. Only "tr" and script supporting elements allowed as children of "thead" element.'); |
|
| 39 | 1 | $this->removeChild($child); |
|
| 40 | 3 | } |
|
| 41 | 3 | } |
|
| 42 | |||
| 43 | 4 | protected function removeInvalidSelf(LoggerInterface $logger) |
|
| 44 | { |
||
| 45 | // "table" must be parent. |
||
| 46 | 4 | $parent = $this->getParent(); |
|
| 47 | 4 | if ($parent !== null && $parent->getName() != 'table') { |
|
| 48 | 1 | $logger->debug($this . ' must be a child of the "table" element.'); |
|
| 49 | |||
| 50 | 1 | return true; |
|
| 51 | } |
||
| 52 | |||
| 53 | 3 | return false; |
|
| 54 | } |
||
| 56 |