TableSection   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getType() 0 3 1
A __construct() 0 5 1
A isHead() 0 3 1
A isBody() 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\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 90
    public function __construct(string $type = self::TYPE_BODY)
33
    {
34 90
        parent::__construct();
35
36 90
        $this->type = $type;
37 90
    }
38
39 75
    public function getType(): string
40
    {
41 75
        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