Completed
Push — master ( fe5500...ee4a91 )
by Colin
02:11
created

StrikethroughRenderer   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 3
dl 0
loc 14
ccs 4
cts 4
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
/*
4
 * This file is part of the league/commonmark-ext-strikethrough package.
5
 *
6
 * (c) Colin O'Dell <[email protected]> and uAfrica.com (http://uafrica.com)
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\Ext\Strikethrough;
13
14
use League\CommonMark\ElementRendererInterface;
15
use League\CommonMark\HtmlElement;
16
use League\CommonMark\Inline\Element\AbstractInline;
17
use League\CommonMark\Inline\Renderer\InlineRendererInterface;
18
use League\CommonMark\Util\Xml;
19
20
final class StrikethroughRenderer implements InlineRendererInterface
21
{
22
    /**
23
     * {@inheritdoc}
24
     */
25 12
    public function render(AbstractInline $inline, ElementRendererInterface $htmlRenderer)
26
    {
27 12
        if (!($inline instanceof Strikethrough)) {
28 3
            throw new \InvalidArgumentException('Incompatible inline type: ' . get_class($inline));
29
        }
30
31 9
        return new HtmlElement('del', $inline->getData('attributes', []), Xml::escape($inline->getContent()));
32
    }
33
}
34