| Conditions | 6 |
| Paths | 9 |
| Total Lines | 20 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 6.0208 |
| Changes | 3 | ||
| Bugs | 2 | Features | 0 |
| 1 | <?php |
||
| 29 | 6 | public function convert(ElementInterface $element) |
|
| 30 | { |
||
| 31 | 6 | $tag = $element->getTagName(); |
|
| 32 | 6 | $value = $element->getValue(); |
|
| 33 | |||
| 34 | 6 | if (!trim($value)) { |
|
| 35 | return ''; |
||
| 36 | } |
||
| 37 | |||
| 38 | 6 | if ($tag === 'i' || $tag === 'em') { |
|
| 39 | 6 | $style = $this->config->getOption('italic_style'); |
|
| 40 | 6 | } else { |
|
| 41 | 6 | $style = $this->config->getOption('bold_style'); |
|
| 42 | } |
||
| 43 | |||
| 44 | 6 | $prefix = ltrim($value) !== $value ? ' ' : ''; |
|
| 45 | 6 | $suffix = rtrim($value) !== $value ? ' ' : ''; |
|
| 46 | |||
| 47 | 6 | return $prefix . $style . trim($value) . $style . $suffix; |
|
| 48 | } |
||
| 49 | |||
| 58 |