Completed
Push — master ( dc2700...65f918 )
by Martin
22:42 queued 16:21
created

TableRows   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 55.56%

Importance

Changes 0
Metric Value
wmc 8
lcom 1
cbo 1
dl 0
loc 47
ccs 10
cts 18
cp 0.5556
rs 10
c 0
b 0
f 0

8 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A isHead() 0 4 1
A isBody() 0 4 1
A matchesNextLine() 0 4 1
A canContain() 0 4 1
A acceptsLines() 0 4 1
A isCode() 0 4 1
A handleRemainingContents() 0 3 1
1
<?php
2
3
/*
4
 * This is part of the webuni/commonmark-table-extension package.
5
 *
6
 * (c) Martin Hasoň <[email protected]>
7
 * (c) Webuni s.r.o. <[email protected]>
8
 *
9
 * For the full copyright and license information, please view the LICENSE
10
 * file that was distributed with this source code.
11
 */
12
13
namespace Webuni\CommonMark\TableExtension;
14
15
use League\CommonMark\Block\Element\AbstractBlock;
16
use League\CommonMark\ContextInterface;
17
use League\CommonMark\Cursor;
18
19
class TableRows extends AbstractBlock
20
{
21
    const TYPE_HEAD = 'thead';
22
    const TYPE_BODY = 'tbody';
23
24
    public $type = self::TYPE_BODY;
25
26 16
    public function __construct($type = self::TYPE_BODY)
27
    {
28 16
        parent::__construct();
29 16
        $this->type = $type;
30 16
    }
31
32 16
    public function isHead()
33
    {
34 16
        return self::TYPE_HEAD === $this->type;
35
    }
36
37 16
    public function isBody()
38
    {
39 16
        return self::TYPE_BODY === $this->type;
40
    }
41
42
    public function canContain(AbstractBlock $block)
43
    {
44
        return $block instanceof TableRow;
45
    }
46
47
    public function acceptsLines()
48
    {
49
        return false;
50
    }
51
52
    public function isCode()
53
    {
54
        return false;
55
    }
56
57 16
    public function matchesNextLine(Cursor $cursor)
58
    {
59 16
        return false;
60
    }
61
62
    public function handleRemainingContents(ContextInterface $context, Cursor $cursor)
63
    {
64
    }
65
}
66