| Conditions | 4 |
| Paths | 6 |
| Total Lines | 20 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 4.7286 |
| Changes | 0 | ||
| 1 | <?php |
||
| 14 | 3 | public function convert(ElementInterface $element) |
|
| 15 | { |
||
| 16 | 3 | $href = $element->getAttribute('href'); |
|
| 17 | 3 | $title = $element->getAttribute('title'); |
|
| 18 | 3 | $text = $element->getValue(); |
|
| 19 | |||
| 20 | 3 | if ($title !== '') { |
|
| 21 | $markdown = '[' . $text . '](' . $href . ' "' . $title . '")'; |
||
| 22 | 3 | } elseif ($href === $text) { |
|
| 23 | $markdown = '<' . $href . '>'; |
||
| 24 | } else { |
||
| 25 | 3 | $markdown = '[' . $text . '](' . $href . ')'; |
|
| 26 | } |
||
| 27 | |||
| 28 | 3 | if (!$href) { |
|
| 29 | $markdown = html_entity_decode($element->getChildrenAsString()); |
||
| 30 | } |
||
| 31 | |||
| 32 | 3 | return $markdown; |
|
| 33 | } |
||
| 34 | |||
| 43 |