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

MarkdownRenderer::renderBody()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
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