Completed
Push — latest ( 6c0640...3af091 )
by Colin
16s queued 11s
created

DescriptionTermContinueParser::tryContinue()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 0
cts 2
cp 0
rs 10
cc 1
nc 1
nop 2
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the league/commonmark package.
7
 *
8
 * (c) Colin O'Dell <[email protected]>
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace League\CommonMark\Extension\DescriptionList\Parser;
15
16
use League\CommonMark\Extension\DescriptionList\Node\DescriptionTerm;
17
use League\CommonMark\Node\Block\AbstractBlock;
18
use League\CommonMark\Parser\Block\AbstractBlockContinueParser;
19
use League\CommonMark\Parser\Block\BlockContinue;
20
use League\CommonMark\Parser\Block\BlockContinueParserInterface;
21
use League\CommonMark\Parser\Block\BlockContinueParserWithInlinesInterface;
22
use League\CommonMark\Parser\Cursor;
23
use League\CommonMark\Parser\InlineParserEngineInterface;
24
25
final class DescriptionTermContinueParser extends AbstractBlockContinueParser implements BlockContinueParserWithInlinesInterface
26
{
27
    /** @var DescriptionTerm */
28
    private $block;
29
30
    /** @var string */
31
    private $term;
32
33 30
    public function __construct(string $term)
34
    {
35 30
        $this->block = new DescriptionTerm();
36 30
        $this->term  = $term;
37 30
    }
38
39 30
    public function getBlock(): AbstractBlock
40
    {
41 30
        return $this->block;
42
    }
43
44
    public function tryContinue(Cursor $cursor, BlockContinueParserInterface $activeBlockParser): ?BlockContinue
45
    {
46
        return BlockContinue::finished();
47
    }
48
49 30
    public function parseInlines(InlineParserEngineInterface $inlineParser): void
50
    {
51 30
        if ($this->term !== '') {
52 30
            $inlineParser->parse($this->term, $this->block);
53
        }
54 30
    }
55
}
56