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

HeadingParser   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 4
dl 0
loc 29
ccs 11
cts 11
cp 1
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getBlock() 0 4 1
A tryContinue() 0 4 1
A parseInlines() 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
 * 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