Document   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 2
dl 0
loc 49
ccs 12
cts 12
cp 1
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getReferenceMap() 0 4 1
A canContain() 0 4 1
A isCode() 0 4 1
A matchesNextLine() 0 4 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
 * 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
15
namespace League\CommonMark\Block\Element;
16
17
use League\CommonMark\Cursor;
18
use League\CommonMark\Reference\ReferenceMap;
19
use League\CommonMark\Reference\ReferenceMapInterface;
20
21
/**
22
 * @method children() AbstractBlock[]
23
 */
24
class Document extends AbstractBlock
25
{
26
    /***
27
     * @var ReferenceMapInterface
28
     */
29
    protected $referenceMap;
30
31 2109
    public function __construct(?ReferenceMapInterface $referenceMap = null)
32
    {
33 2109
        $this->setStartLine(1);
34
35 2109
        $this->referenceMap = $referenceMap ?? new ReferenceMap();
36 2109
    }
37
38
    /**
39
     * @return ReferenceMapInterface
40
     */
41 2079
    public function getReferenceMap(): ReferenceMapInterface
42
    {
43 2079
        return $this->referenceMap;
44
    }
45
46
    /**
47
     * Returns true if this block can contain the given block as a child node
48
     *
49
     * @param AbstractBlock $block
50
     *
51
     * @return bool
52
     */
53 2067
    public function canContain(AbstractBlock $block): bool
54
    {
55 2067
        return true;
56
    }
57
58
    /**
59
     * Whether this is a code block
60
     *
61
     * @return bool
62
     */
63 2067
    public function isCode(): bool
64
    {
65 2067
        return false;
66
    }
67
68 3
    public function matchesNextLine(Cursor $cursor): bool
69
    {
70 3
        return true;
71
    }
72
}
73