DocumentRenderer   A
last analyzed

Coupling/Cohesion

Components 0
Dependencies 2

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A render() 0 10 3
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\Renderer;
16
17
use League\CommonMark\Block\Element\AbstractBlock;
18
use League\CommonMark\Block\Element\Document;
19
use League\CommonMark\ElementRendererInterface;
20
21
class DocumentRenderer implements BlockRendererInterface
22
{
23
    /**
24
     * @param AbstractBlock|Document   $block
25
     * @param ElementRendererInterface $htmlRenderer
26
     * @param bool                     $inTightList
27
     *
28
     * @return string
29
     */
30 1950
    public function render(AbstractBlock $block, ElementRendererInterface $htmlRenderer, $inTightList = false)
31
    {
32 1950
        if (!($block instanceof Document)) {
33 3
            throw new \InvalidArgumentException('Incompatible block type: ' . get_class($block));
34
        }
35
36 1947
        $wholeDoc = $htmlRenderer->renderBlocks($block->children());
37
38 1947
        return $wholeDoc === '' ? '' : $wholeDoc . "\n";
39
    }
40
}
41