Passed
Push — master ( 85e8bc...daebd5 )
by Andrey
01:47
created

CommentConverter   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A convert() 0 7 2
1
<?php
2
declare(strict_types=1);
3
4
namespace Rarst\Hugo\wprss2hugo\Serializer;
5
6
use League\HTMLToMarkdown\ElementInterface;
7
8
/**
9
 * Extend comment converter to preserve 'more' tags.
10
 */
11
class CommentConverter extends \League\HTMLToMarkdown\Converter\CommentConverter
12
{
13
    /**
14
     * Discard HTML comments, except 'more' tag.
15
     */
16
    public function convert(ElementInterface $element)
17
    {
18
        if ('more' === $element->getValue()) {
19
            return '<!--more-->';
20
        }
21
22
        return '';
23
    }
24
}
25