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

MarkdownParser   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 18
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A parse() 0 3 1
A __construct() 0 3 1
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