Completed
Push — refactor-parsing ( adbb6b...fbe6de )
by Colin
08:21 queued 07:01
created

ListBlock::finalize()   B

Complexity

Conditions 10
Paths 6

Size

Total Lines 27

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 13
CRAP Score 10.0363

Importance

Changes 0
Metric Value
dl 0
loc 27
ccs 13
cts 14
cp 0.9286
rs 7.6666
c 0
b 0
f 0
cc 10
nc 6
nop 2
crap 10.0363

How to fix   Complexity   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
3
/*
4
 * This file is part of the league/commonmark package.
5
 *
6
 * (c) Colin O'Dell <[email protected]>
7
 *
8
 * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js)
9
 *  - (c) John MacFarlane
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 League\CommonMark\Extension\CommonMark\Node\Block;
16
17
use League\CommonMark\Node\Block\AbstractBlock;
18
19
/**
20
 * @method children() AbstractBlock[]
21
 */
22
class ListBlock extends AbstractBlock
23
{
24
    const TYPE_BULLET = 'bullet';
25
    const TYPE_ORDERED = 'ordered';
26
27
    /**
28
     * @var bool
29
     */
30
    protected $tight = false;
31
32
    /**
33
     * @var ListData
34
     */
35
    protected $listData;
36
37 339
    public function __construct(ListData $listData)
38
    {
39 339
        $this->listData = $listData;
40 339
    }
41
42
    /**
43
     * @return ListData
44
     */
45 333
    public function getListData(): ListData
46
    {
47 333
        return $this->listData;
48
    }
49
50 315
    public function isTight(): bool
51
    {
52 315
        return $this->tight;
53
    }
54
55 285
    public function setTight(bool $tight): self
56
    {
57 285
        $this->tight = $tight;
58
59 285
        return $this;
60
    }
61
}
62