AbstractStringContainerBlock   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 2
dl 0
loc 39
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A addLine() 0 4 1
handleRemainingContents() 0 1 ?
A getStringContent() 0 4 1
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\Block\Element;
16
17
use League\CommonMark\ContextInterface;
18
use League\CommonMark\Cursor;
19
use League\CommonMark\Util\ArrayCollection;
20
21
/**
22
 * @method children() AbstractInline[]
23
 */
24
abstract class AbstractStringContainerBlock extends AbstractBlock implements StringContainerInterface
25
{
26
    /**
27
     * @var ArrayCollection|string[]
28
     */
29
    protected $strings;
30
31
    /**
32
     * @var string
33
     */
34
    protected $finalStringContents = '';
35
36
    /**
37
     * Constructor
38
     */
39 2133
    public function __construct()
40
    {
41 2133
        $this->strings = new ArrayCollection();
42 2133
    }
43
44
    /**
45
     * @param string $line
46
     */
47 2070
    public function addLine(string $line)
48
    {
49 2070
        $this->strings->add($line);
50 2070
    }
51
52
    /**
53
     * @param ContextInterface $context
54
     * @param Cursor           $cursor
55
     */
56
    abstract public function handleRemainingContents(ContextInterface $context, Cursor $cursor);
57
58 2034
    public function getStringContent(): string
59
    {
60 2034
        return $this->finalStringContents;
61
    }
62
}
63