Completed
Push — master ( b4ff9c...fbe6de )
by Colin
01:00
created

HeadingParser::getBlock()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 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
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace League\CommonMark\Extension\CommonMark\Parser\Block;
13
14
use League\CommonMark\Extension\CommonMark\Node\Block\Heading;
15
use League\CommonMark\Node\Block\AbstractBlock;
16
use League\CommonMark\Parser\Block\AbstractBlockContinueParser;
17
use League\CommonMark\Parser\Block\BlockContinue;
18
use League\CommonMark\Parser\Block\BlockContinueParserInterface;
19
use League\CommonMark\Parser\Cursor;
20
use League\CommonMark\Parser\InlineParserEngineInterface;
21
22
final class HeadingParser extends AbstractBlockContinueParser
23
{
24
    /** @var Heading */
25
    private $block;
26
27
    /** @var string */
28
    private $content;
29
30 189
    public function __construct(int $level, string $content)
31
    {
32 189
        $this->block = new Heading($level);
33 189
        $this->content = $content;
34 189
    }
35
36 189
    public function getBlock(): AbstractBlock
37
    {
38 189
        return $this->block;
39
    }
40
41 111
    public function tryContinue(Cursor $cursor, BlockContinueParserInterface $activeBlockParser): ?BlockContinue
42
    {
43 111
        return BlockContinue::none();
44
    }
45
46 189
    public function parseInlines(InlineParserEngineInterface $inlineParser): void
47
    {
48 189
        $inlineParser->parse($this->content, $this->block);
49 189
    }
50
}
51