Completed
Push — master ( 13ce47...b2c9cd )
by Andreas
10:39 queued 06:48
created

Draft   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 25
rs 10
c 0
b 0
f 0
wmc 5
lcom 0
cbo 2

3 Methods

Rating   Name   Duplication   Size   Complexity  
A minimumPermission() 0 8 2
A tplContent() 0 3 1
A checkPreconditions() 0 5 2
1
<?php
2
3
namespace dokuwiki\Action;
4
5
use dokuwiki\Action\Exception\ActionException;
6
7
/**
8
 * Class Draft
9
 *
10
 * Screen to see and recover a draft
11
 *
12
 * @package dokuwiki\Action
13
 * @fixme combine with Recover?
14
 */
15
class Draft extends AbstractAction {
16
17
    /** @inheritdoc */
18
    public function minimumPermission() {
19
        global $INFO;
20
        if($INFO['exists']) {
21
            return AUTH_EDIT;
22
        } else {
23
            return AUTH_CREATE;
24
        }
25
    }
26
27
    /** @inheritdoc */
28
    public function checkPreconditions() {
29
        parent::checkPreconditions();
30
        global $INFO;
31
        if(!file_exists($INFO['draft'])) throw new ActionException('edit');
32
    }
33
34
    /** @inheritdoc */
35
    public function tplContent() {
36
        html_draft();
37
    }
38
39
}
40