TableSection::getType()   A
last analyzed

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 0
Metric Value
eloc 1
dl 0
loc 3
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 96
    public function __construct(string $type = self::TYPE_BODY)
33
    {
34 96
        parent::__construct();
35
36 96
        $this->type = $type;
37 96
    }
38
39 81
    public function getType(): string
40
    {
41 81
        return $this->type;
42
    }
43
44 3
    public function isHead(): bool
45
    {
46 3
        return $this->type === self::TYPE_HEAD;
47
    }
48
49 3
    public function isBody(): bool
50
    {
51 3
        return $this->type === self::TYPE_BODY;
52
    }
53
}
54