Test Setup Failed
Pull Request — latest (#3)
by Mark
65:38 queued 30:20
created

DocumentRenderer   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 9
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 4
c 1
b 0
f 0
dl 0
loc 9
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A render() 0 7 2
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file was originally part of the league/commonmark package.
7
 *
8
 * (c) Colin O'Dell <[email protected]>
9
 *
10
 * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js)
11
 *  - (c) John MacFarlane
12
 *
13
 * For the full copyright and license information, please view the LICENSE
14
 * file that was distributed with this source code.
15
 */
16
17
namespace UnicornFail\Emoji\Renderer\Block;
18
19
use UnicornFail\Emoji\Node\Block\Document;
20
use UnicornFail\Emoji\Node\Node;
21
use UnicornFail\Emoji\Renderer\ChildNodeRendererInterface;
22
use UnicornFail\Emoji\Renderer\NodeRendererInterface;
23
24
final class DocumentRenderer implements NodeRendererInterface
25
{
26
    public function render(Node $node, ChildNodeRendererInterface $childRenderer): string
27
    {
28
        if (! ($node instanceof Document)) {
29
            throw new \InvalidArgumentException('Incompatible node type: ' . \get_class($node));
30
        }
31
32
        return $childRenderer->renderNodes($node->children());
33
    }
34
}
35