Completed
Push — master ( ab4467...e26782 )
by Colin
03:21
created

TableSection   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getType() 0 4 1
A isHead() 0 4 1
A isBody() 0 4 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\Node\Block\AbstractBlock;
19
20
final class TableSection extends AbstractBlock
21
{
22
    public const TYPE_HEAD = 'thead';
23
    public const TYPE_BODY = 'tbody';
24
25
    /**
26
     * @var string
27
     *
28
     * @psalm-readonly
29
     */
30
    private $type;
31
32 87
    public function __construct(string $type = self::TYPE_BODY)
33
    {
34 87
        $this->type = $type;
35 87
    }
36
37 72
    public function getType(): string
38
    {
39 72
        return $this->type;
40
    }
41
42 3
    public function isHead(): bool
43
    {
44 3
        return $this->type === self::TYPE_HEAD;
45
    }
46
47 3
    public function isBody(): bool
48
    {
49 3
        return $this->type === self::TYPE_BODY;
50
    }
51
}
52