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

FootnoteRef   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Test Coverage

Coverage 91.67%

Importance

Changes 0
Metric Value
eloc 11
c 0
b 0
f 0
dl 0
loc 35
ccs 11
cts 12
cp 0.9167
rs 10
wmc 5

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getContent() 0 3 1
A getReference() 0 3 1
A __construct() 0 9 2
A setReference() 0 3 1
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