TableRows::matchesNextLine()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 3
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This is part of the webuni/commonmark-table-extension package.
7
 *
8
 * (c) Martin Hasoň <[email protected]>
9
 * (c) Webuni s.r.o. <[email protected]>
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 Webuni\CommonMark\TableExtension;
16
17
use League\CommonMark\Block\Element\AbstractBlock;
18
use League\CommonMark\Block\Element\AbstractStringContainerBlock;
19
use League\CommonMark\Block\Element\InlineContainerInterface;
20
use League\CommonMark\ContextInterface;
21
use League\CommonMark\Cursor;
22
23
class TableRows extends AbstractStringContainerBlock implements InlineContainerInterface
24
{
25
    const TYPE_HEAD = 'thead';
26
    const TYPE_BODY = 'tbody';
27
28
    public $type = self::TYPE_BODY;
29
30
    public function __construct(string $type = self::TYPE_BODY)
31
    {
32
        parent::__construct();
33
        $this->type = $type;
34
    }
35
36
    public function isHead(): bool
37
    {
38
        return self::TYPE_HEAD === $this->type;
39
    }
40
41
    public function isBody(): bool
42
    {
43
        return self::TYPE_BODY === $this->type;
44
    }
45
46
    public function canContain(AbstractBlock $block): bool
47
    {
48
        return $block instanceof TableRow;
49
    }
50
51
    public function isCode(): bool
52
    {
53
        return false;
54
    }
55
56
    public function matchesNextLine(Cursor $cursor): bool
57
    {
58
        return false;
59
    }
60
61
    public function handleRemainingContents(ContextInterface $context, Cursor $cursor): void
62
    {
63
    }
64
}
65