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

TableSection::getType()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 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