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

CommentConverter::convert()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 3
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 7
rs 10
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