| Conditions | 3 |
| Paths | 3 |
| Total Lines | 17 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 5 |
| CRAP Score | 3 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 23 | 102 | public function convert(ElementInterface $element): string |
|
| 24 | 102 | { |
|
| 25 | // If strip_tags is false (the default), preserve tags that don't have Markdown equivalents, |
||
| 26 | // such as <span> nodes on their own. C14N() canonicalizes the node to a string. |
||
| 27 | // See: http://www.php.net/manual/en/domnode.c14n.php |
||
| 28 | if ($this->config->getOption('strip_tags', false)) { |
||
| 29 | return $element->getValue(); |
||
| 30 | } |
||
| 31 | 96 | ||
| 32 | $markdown = \html_entity_decode($element->getChildrenAsString()); |
||
| 33 | |||
| 34 | // Tables are only handled here if TableConverter is not used |
||
| 35 | if ($element->getTagName() === 'table') { |
||
| 36 | 96 | $markdown .= "\n\n"; |
|
| 37 | 18 | } |
|
| 38 | |||
| 39 | return $markdown; |
||
| 40 | 87 | } |
|
| 50 |