Passed
Push — master ( 2d5d29...0740c8 )
by ReliQ
04:50 queued 13s
created

MarkdownParser::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace ReliqArts\Docweaver\Service;
6
7
use League\CommonMark\ConverterInterface;
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 ConverterInterface
17
     */
18
    private ConverterInterface $converter;
19
20
    /**
21
     * CommonMarkConverter constructor.
22
     */
23
    public function __construct(ConverterInterface $converter)
24
    {
25
        $this->converter = $converter;
26
    }
27
28
    public function parse(string $text): string
29
    {
30
        return $this->converter->convertToHtml($text);
31
    }
32
}
33