WebCommentParser::parse()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
c 0
b 0
f 0
rs 9.4285
cc 2
eloc 4
nc 2
nop 1
1
<?php
2
namespace rtens\domin\delivery\web;
3
4
use rtens\domin\reflection\CommentParser;
5
6
class WebCommentParser extends CommentParser {
7
8
    public function shorten($description) {
9
        return strip_tags(explode('</p>', parent::shorten($description))[0], '<b><i><s><u><strong><em>');
10
    }
11
12
    public function parse($comment) {
13
        if (class_exists(\Parsedown::class)) {
14
            return (new \Parsedown())->text($comment);
15
        }
16
        return nl2br(parent::parse($comment));
17
    }
18
}