Test Failed
Push — feature-laravel-5.4 ( 2b4b90...5bfdc4 )
by Kirill
03:52
created

MarkdownRenderer   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A render() 0 8 1
1
<?php
2
3
/**
4
 * This file is part of laravel.su package.
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
declare(strict_types=1);
10
11
namespace App\Services\ContentRenderer;
12
13
use cebe\markdown\Parser;
14
15
/**
16
 * Class MarkdownRenderer.
17
 */
18
class MarkdownRenderer extends AbstractRenderer
19
{
20
    /**
21
     * @var Parser
22
     */
23
    private $parser;
24
25
    /**
26
     * MarkdownRenderer constructor.
27
     *
28
     * @param Parser $parser
29
     */
30
    public function __construct(Parser $parser)
31
    {
32
        $this->parser = $parser;
33
    }
34
35
    /**
36
     * @param  string $body
37
     * @return string
38
     */
39
    public function render(string $body): string
40
    {
41
        $body = $this->fireBefore($body);
42
43
        $body = $this->parser->parse($body);
44
45
        return $this->fireAfter($body);
46
    }
47
}
48