Passed
Pull Request — master (#1932)
by Struan
04:51
created

BaseView::format_body()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 4
rs 10
1
<?php
2
3
namespace MySociety\TheyWorkForYou\GlossaryView;
4
5
class BaseView {
6
    protected function format_body($body): string {
7
        $Parsedown = new \Parsedown();
8
        $Parsedown->setSafeMode(true);
9
        return $Parsedown->text($body);
10
    }
11
12
    protected function has_edit_access(): bool {
13
        global $THEUSER;
14
15
        if (!$THEUSER->is_able_to('addterm')) {
16
            return false;
17
        }
18
19
        return true;
20
    }
21
}
22