Passed
Push — latest ( 2ee702...5d397b )
by Colin
02:38 queued 12s
created

MarkdownInputWithFrontMatter::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 5
ccs 3
cts 3
cp 1
rs 10
cc 1
nc 1
nop 3
crap 1
1
<?php
2
3
/*
4
 * This file is part of the league/commonmark package.
5
 *
6
 * (c) Colin O'Dell <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
declare(strict_types=1);
13
14
namespace League\CommonMark\Extension\FrontMatter\Input;
15
16
use League\CommonMark\Extension\FrontMatter\FrontMatterProviderInterface;
17
use League\CommonMark\Input\MarkdownInput;
18
19
final class MarkdownInputWithFrontMatter extends MarkdownInput implements FrontMatterProviderInterface
20
{
21
    /** @var mixed|null */
22
    private $frontMatter;
23
24
    /**
25
     * @param string     $content     Markdown content without the raw front matter
26
     * @param int        $lineOffset  Line offset (based on number of front matter lines removed)
27
     * @param mixed|null $frontMatter Parsed front matter
28
     */
29 21
    public function __construct(string $content, int $lineOffset = 0, $frontMatter = null)
30
    {
31 21
        parent::__construct($content, $lineOffset);
32
33 21
        $this->frontMatter = $frontMatter;
34 21
    }
35
36
    /**
37
     * {@inheritDoc}
38
     */
39 21
    public function getFrontMatter()
40
    {
41 21
        return $this->frontMatter;
42
    }
43
}
44