WebCommentParser::shorten()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

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