TableCell::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 0
cts 6
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 3
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This is part of the webuni/commonmark-table-extension package.
7
 *
8
 * (c) Martin Hasoň <[email protected]>
9
 * (c) Webuni s.r.o. <[email protected]>
10
 *
11
 * For the full copyright and license information, please view the LICENSE
12
 * file that was distributed with this source code.
13
 */
14
15
namespace Webuni\CommonMark\TableExtension;
16
17
use League\CommonMark\Block\Element\AbstractBlock;
18
use League\CommonMark\Block\Element\AbstractStringContainerBlock;
19
use League\CommonMark\Block\Element\InlineContainerInterface;
20
use League\CommonMark\ContextInterface;
21
use League\CommonMark\Cursor;
22
23
class TableCell extends AbstractStringContainerBlock implements InlineContainerInterface
24
{
25
    const TYPE_HEAD = 'th';
26
    const TYPE_BODY = 'td';
27
28
    const ALIGN_LEFT = 'left';
29
    const ALIGN_RIGHT = 'right';
30
    const ALIGN_CENTER = 'center';
31
32
    public $type = self::TYPE_BODY;
33
    public $align;
34
35
    public function __construct(string $string = '', string $type = self::TYPE_BODY, string $align = null)
36
    {
37
        parent::__construct();
38
        $this->finalStringContents = $string;
39
        $this->addLine($string);
40
        $this->type = $type;
41
        $this->align = $align;
42
    }
43
44
    public function canContain(AbstractBlock $block): bool
45
    {
46
        return false;
47
    }
48
49
    public function isCode(): bool
50
    {
51
        return false;
52
    }
53
54
    public function matchesNextLine(Cursor $cursor): bool
55
    {
56
        return false;
57
    }
58
59
    public function handleRemainingContents(ContextInterface $context, Cursor $cursor): void
60
    {
61
    }
62
}
63