Passed
Push — main ( a14783...3f9333 )
by Colin
04:56 queued 02:39
created

FootnoteRef::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2.0185

Importance

Changes 0
Metric Value
cc 2
eloc 5
c 0
b 0
f 0
nc 2
nop 3
dl 0
loc 9
ccs 5
cts 6
cp 0.8333
crap 2.0185
rs 10
1
<?php
2
3
/*
4
 * This file is part of the league/commonmark package.
5
 *
6
 * (c) Colin O'Dell <[email protected]>
7
 * (c) Rezo Zero / Ambroise Maupate
8
 *
9
 * For the full copyright and license information, please view the LICENSE
10
 * file that was distributed with this source code.
11
 */
12
13
declare(strict_types=1);
14
15
namespace League\CommonMark\Extension\Footnote\Node;
16
17
use League\CommonMark\Node\Inline\AbstractInline;
18
use League\CommonMark\Reference\ReferenceInterface;
19
use League\CommonMark\Reference\ReferenceableInterface;
20
21
final class FootnoteRef extends AbstractInline implements ReferenceableInterface
22
{
23
    private ReferenceInterface $reference;
24
25
    /** @psalm-readonly */
26
    private ?string $content = null;
27
28
    /**
29
     * @param array<mixed> $data
30
     */
31 94
    public function __construct(ReferenceInterface $reference, ?string $content = null, array $data = [])
32
    {
33 94
        parent::__construct();
34
35 94
        $this->reference = $reference;
36 94
        $this->content   = $content;
37
38 94
        if (\count($data) > 0) {
39
            $this->data->import($data);
40
        }
41
    }
42
43 94
    public function getReference(): ReferenceInterface
44
    {
45 94
        return $this->reference;
46
    }
47
48 86
    public function setReference(ReferenceInterface $reference): void
49
    {
50 86
        $this->reference = $reference;
51
    }
52
53 86
    public function getContent(): ?string
54
    {
55 86
        return $this->content;
56
    }
57
}
58