Completed
Push — master ( 91746d...c63af8 )
by ReliQ
09:16
created

MarkdownParser::parse()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace ReliqArts\Docweaver\Service;
6
7
use ParsedownExtra;
8
use ReliqArts\Docweaver\Contract\MarkdownParser as MDParser;
9
10
/**
11
 * Docweaver markdown helper.
12
 */
13
final class MarkdownParser implements MDParser
14
{
15
    /**
16
     * @var ParsedownExtra
17
     */
18
    private $interpreter;
19
20
    /**
21
     * MarkdownParser constructor.
22
     *
23
     * @param ParsedownExtra $interpreter
24
     */
25
    public function __construct(ParsedownExtra $interpreter)
26
    {
27
        $this->interpreter = $interpreter;
28
    }
29
30
    /**
31
     * @param string $text
32
     *
33
     * @return string
34
     */
35
    public function parse(string $text): string
36
    {
37
        return $this->interpreter->text($text);
38
    }
39
}
40