| Conditions | 5 |
| Paths | 3 |
| Total Lines | 18 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 5 |
| Changes | 0 | ||
| 1 | <?php |
||
| 30 | 4 | protected function removeInvalidSelf(LoggerInterface $logger) : bool |
|
| 31 | { |
||
| 32 | // "base" element must be child of "head" element. |
||
| 33 | 4 | if ($this->getParent() !== null && !($this->getParent() instanceof Head)) { |
|
| 34 | 1 | $logger->debug('Removing ' . $this . '. Must be a "head" element child.'); |
|
| 35 | |||
| 36 | 1 | return true; |
|
| 37 | } |
||
| 38 | |||
| 39 | // Must have either "href" or "target" attribute or both. |
||
| 40 | 3 | if (!$this->hasAttribute('href') && !$this->hasAttribute('target')) { |
|
| 41 | 1 | $logger->debug('Removing ' . $this . '. Must have either the "href" or "target" attribute or both.'); |
|
| 42 | |||
| 43 | 1 | return true; |
|
| 44 | } |
||
| 45 | |||
| 46 | 2 | return false; |
|
| 47 | } |
||
| 48 | } |
||
| 49 |