ChildRenderer   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
eloc 5
dl 0
loc 13
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A render() 0 8 2
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the league/commonmark package.
7
 *
8
 * (c) Colin O'Dell <[email protected]>
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace League\CommonMark\Extension\InlinesOnly;
15
16
use League\CommonMark\Node\Block\Document;
17
use League\CommonMark\Node\Node;
18
use League\CommonMark\Renderer\ChildNodeRendererInterface;
19
use League\CommonMark\Renderer\NodeRendererInterface;
20
21
/**
22
 * Simply renders child elements as-is, adding newlines as needed.
23
 */
24
final class ChildRenderer implements NodeRendererInterface
25
{
26
    /**
27
     * {@inheritdoc}
28
     */
29 3
    public function render(Node $node, ChildNodeRendererInterface $childRenderer)
30
    {
31 3
        $out = $childRenderer->renderNodes($node->children());
32 3
        if (! $node instanceof Document) {
33 3
            $out .= $childRenderer->getBlockSeparator();
34
        }
35
36 3
        return $out;
37
    }
38
}
39