1<?php
2
3/*
4 * This file is part of the league/commonmark package.
5 *
6 * (c) Colin O'Dell <colinodell@gmail.com>
7 *
8 * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js)
9 *  - (c) John MacFarlane
10 *
11 * For the full copyright and license information, please view the LICENSE
12 * file that was distributed with this source code.
13 */
14
15namespace League\CommonMark\Block\Element;
16
17use League\CommonMark\Cursor;
18use League\CommonMark\Reference\ReferenceMap;
19use League\CommonMark\Reference\ReferenceMapInterface;
20
21/**
22 * @method children() AbstractBlock[]
23 */
24class Document extends AbstractBlock
25{
26    /** @var ReferenceMapInterface */
27    protected $referenceMap;
28
29    public function __construct(?ReferenceMapInterface $referenceMap = null)
30    {
31        $this->setStartLine(1);
32
33        $this->referenceMap = $referenceMap ?? new ReferenceMap();
34    }
35
36    /**
37     * @return ReferenceMapInterface
38     */
39    public function getReferenceMap(): ReferenceMapInterface
40    {
41        return $this->referenceMap;
42    }
43
44    public function canContain(AbstractBlock $block): bool
45    {
46        return true;
47    }
48
49    public function isCode(): bool
50    {
51        return false;
52    }
53
54    public function matchesNextLine(Cursor $cursor): bool
55    {
56        return true;
57    }
58}
59