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

BaseView::has_edit_access()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

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