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

DescriptionListContinueParser::isContainer()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
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
declare(strict_types=1);
13
14
namespace League\CommonMark\Extension\DescriptionList\Parser;
15
16
use League\CommonMark\Extension\DescriptionList\Node\Description;
17
use League\CommonMark\Extension\DescriptionList\Node\DescriptionList;
18
use League\CommonMark\Extension\DescriptionList\Node\DescriptionTerm;
19
use League\CommonMark\Node\Block\AbstractBlock;
20
use League\CommonMark\Parser\Block\AbstractBlockContinueParser;
21
use League\CommonMark\Parser\Block\BlockContinue;
22
use League\CommonMark\Parser\Block\BlockContinueParserInterface;
23
use League\CommonMark\Parser\Cursor;
24
25
final class DescriptionListContinueParser extends AbstractBlockContinueParser
26
{
27
    /** @var DescriptionList */
28
    private $block;
29
30 30
    public function __construct()
31
    {
32 30
        $this->block = new DescriptionList();
33 30
    }
34
35
    /**
36
     * @return DescriptionList
37
     */
38 30
    public function getBlock(): AbstractBlock
39
    {
40 30
        return $this->block;
41
    }
42
43 27
    public function tryContinue(Cursor $cursor, BlockContinueParserInterface $activeBlockParser): ?BlockContinue
44
    {
45 27
        return BlockContinue::at($cursor);
46
    }
47
48 30
    public function isContainer(): bool
49
    {
50 30
        return true;
51
    }
52
53 30
    public function canContain(AbstractBlock $childBlock): bool
54
    {
55 30
        return $childBlock instanceof DescriptionTerm || $childBlock instanceof Description;
56
    }
57
}
58