| Conditions | 7 |
| Paths | 4 |
| Total Lines | 22 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 7 |
| Changes | 0 | ||
| 1 | <?php |
||
| 33 | 6 | protected function removeInvalidSelf(LoggerInterface $logger) : bool |
|
| 34 | { |
||
| 35 | // Only allowed: |
||
| 36 | // Inside ol elements. |
||
| 37 | // Inside ul elements. |
||
| 38 | // Inside menu elements whose type attribute is in the toolbar state. |
||
| 39 | 6 | $parent = $this->getParent(); |
|
| 40 | 6 | if ($parent === null || $parent instanceof Ol || $parent instanceof Ul) { |
|
| 41 | 4 | return false; |
|
| 42 | } |
||
| 43 | |||
| 44 | 2 | if ($parent instanceof Menu && $parent->hasAttribute('type')) { |
|
| 45 | 1 | $typeAttributeValue = $parent->getAttribute('type'); |
|
| 46 | 1 | if ($typeAttributeValue === 'toolbar') { |
|
| 47 | 1 | return false; |
|
| 48 | } |
||
| 49 | } |
||
| 50 | |||
| 51 | 2 | $logger->debug('Removing ' . $this . '. Only allowed inside the "li" element are "ol", "ul" and "menu[type=toolbar]" elements.'); |
|
| 52 | |||
| 53 | 2 | return true; |
|
| 54 | } |
||
| 55 | } |
||
| 56 |