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

MarkdownParser   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 1
dl 0
loc 27
rs 10
c 0
b 0
f 0

2 Methods

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