Completed
Push — master ( 9292e6...a84270 )
by Colin
03:12 queued 02:10
created

ChildRenderer   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

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

1 Method

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