Conditions | 3 |
Paths | 3 |
Total Lines | 23 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 11 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
22 | 3 | public function convert(ElementInterface $element) |
|
23 | { |
||
24 | // Contents should have already been converted to Markdown by this point, |
||
25 | // so we just need to add '>' symbols to each line. |
||
26 | |||
27 | 3 | $markdown = ''; |
|
28 | |||
29 | 3 | $quote = trim($element->getValue()); |
|
30 | |||
31 | 3 | $lines = preg_split('/\r\n|\r|\n/', $quote); |
|
32 | |||
33 | 3 | $total = count((array) $lines); |
|
34 | |||
35 | 3 | foreach ($lines as $i => $line) |
|
36 | { |
||
37 | 3 | $markdown .= '> ' . $line . "\n"; |
|
38 | |||
39 | 3 | $newline = $i + 1 === $total; |
|
40 | |||
41 | 3 | $newline && $markdown .= "\n"; |
|
42 | 1 | } |
|
43 | |||
44 | 3 | return "\n\n" . $markdown; |
|
45 | } |
||
57 |