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