1<?php
2
3/*
4 * This file is part of the league/commonmark package.
5 *
6 * (c) Colin O'Dell <colinodell@gmail.com>
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
13declare(strict_types=1);
14
15namespace League\CommonMark\Extension\Footnote\Node;
16
17use League\CommonMark\Node\Inline\AbstractInline;
18use League\CommonMark\Reference\ReferenceInterface;
19use League\CommonMark\Reference\ReferenceableInterface;
20
21final 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    public function __construct(ReferenceInterface $reference, ?string $content = null, array $data = [])
32    {
33        parent::__construct();
34
35        $this->reference = $reference;
36        $this->content   = $content;
37
38        if (\count($data) > 0) {
39            $this->data->import($data);
40        }
41    }
42
43    public function getReference(): ReferenceInterface
44    {
45        return $this->reference;
46    }
47
48    public function setReference(ReferenceInterface $reference): void
49    {
50        $this->reference = $reference;
51    }
52
53    public function getContent(): ?string
54    {
55        return $this->content;
56    }
57}
58