Passed
Branch refactor-markdown-helper (02b3eb)
by Caen
04:15
created

MarkdownConverter::getEnvironment()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 5
rs 10
1
<?php
2
3
namespace Hyde\Framework\Modules\Markdown;
4
5
use League\CommonMark\Environment\Environment;
6
use League\CommonMark\Extension\CommonMark\CommonMarkCoreExtension;
7
8
/**
9
 * The base Markdown converter class.
10
 *
11
 * "Extends" \League\CommonMark\CommonMarkConverter.
12
 */
13
class MarkdownConverter extends \League\CommonMark\MarkdownConverter
14
{
15
    /**
16
     * Create a new Markdown converter pre-configured for CommonMark.
17
     *
18
     * @param  array<string, mixed>  $config
19
     */
20
    public function __construct(array $config = [])
21
    {
22
        $environment = new Environment($config);
23
        $environment->addExtension(new CommonMarkCoreExtension());
24
25
        parent::__construct($environment);
26
    }
27
28
    public function getEnvironment(): Environment
29
    {
30
        \assert($this->environment instanceof Environment);
31
32
        return $this->environment;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->environment returns the type League\CommonMark\Environment\EnvironmentInterface which includes types incompatible with the type-hinted return League\CommonMark\Environment\Environment.
Loading history...
33
    }
34
}
35