Passed
Pull Request — master (#1932)
by Struan
05:24
created

BaseView   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 15
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A format_body() 0 4 1
A has_edit_access() 0 8 2
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