Completed
Push — master ( 94bc98...2d9023 )
by Martin
09:18
created

TableCaption   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 6
lcom 0
cbo 1
dl 0
loc 39
ccs 0
cts 25
cp 0
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A canContain() 0 4 1
A acceptsLines() 0 4 1
A isCode() 0 4 1
A matchesNextLine() 0 4 1
A children() 0 4 1
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\InlineContainerInterface;
19
use League\CommonMark\Cursor;
20
use League\CommonMark\Inline\Element\AbstractInline;
21
use League\CommonMark\Node\Node;
22
23
class TableCaption extends AbstractBlock implements InlineContainerInterface
24
{
25
    public $id;
26
27
    public function __construct(string $caption, string $id = null)
28
    {
29
        parent::__construct();
30
        $this->finalStringContents = $caption;
31
        $this->id = $id;
32
    }
33
34
    public function canContain(AbstractBlock $block): bool
35
    {
36
        return false;
37
    }
38
39
    public function acceptsLines(): bool
40
    {
41
        return false;
42
    }
43
44
    public function isCode(): bool
45
    {
46
        return false;
47
    }
48
49
    public function matchesNextLine(Cursor $cursor): bool
50
    {
51
        return false;
52
    }
53
54
    /**
55
     * @return AbstractInline[]
56
     */
57
    public function children(): array
58
    {
59
        return array_filter(parent::children(), function (Node $child): bool { return $child instanceof AbstractInline; });
60
    }
61
}
62