Completed
Push — master ( 83739a...a13ee4 )
by Colin
14s queued 11s
created

TableSection   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 37.5%

Importance

Changes 0
Metric Value
wmc 7
lcom 1
cbo 1
dl 0
loc 42
ccs 6
cts 16
cp 0.375
rs 10
c 0
b 0
f 0

7 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A isHead() 0 4 1
A isBody() 0 4 1
A canContain() 0 4 1
A isCode() 0 4 1
A matchesNextLine() 0 4 1
A handleRemainingContents() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This is part of the league/commonmark package.
7
 *
8
 * (c) Martin Hasoň <[email protected]>
9
 * (c) Webuni s.r.o. <[email protected]>
10
 * (c) Colin O'Dell <[email protected]>
11
 *
12
 * For the full copyright and license information, please view the LICENSE
13
 * file that was distributed with this source code.
14
 */
15
16
namespace League\CommonMark\Extension\Table;
17
18
use League\CommonMark\Block\Element\AbstractBlock;
19
use League\CommonMark\Block\Element\AbstractStringContainerBlock;
20
use League\CommonMark\Block\Element\InlineContainerInterface;
21
use League\CommonMark\ContextInterface;
22
use League\CommonMark\Cursor;
23
24
class TableSection extends AbstractStringContainerBlock implements InlineContainerInterface
25
{
26
    const TYPE_HEAD = 'thead';
27
    const TYPE_BODY = 'tbody';
28
29
    public $type = self::TYPE_BODY;
30
31 69
    public function __construct(string $type = self::TYPE_BODY)
32
    {
33 69
        parent::__construct();
34 69
        $this->type = $type;
35 69
    }
36
37
    public function isHead(): bool
38
    {
39
        return self::TYPE_HEAD === $this->type;
40
    }
41
42
    public function isBody(): bool
43
    {
44
        return self::TYPE_BODY === $this->type;
45
    }
46
47
    public function canContain(AbstractBlock $block): bool
48
    {
49
        return $block instanceof TableRow;
50
    }
51
52
    public function isCode(): bool
53
    {
54
        return false;
55
    }
56
57 66
    public function matchesNextLine(Cursor $cursor): bool
58
    {
59 66
        return false;
60
    }
61
62
    public function handleRemainingContents(ContextInterface $context, Cursor $cursor): void
63
    {
64
    }
65
}
66