Failed Conditions
Push — psr2 ( 8eb28c...c68e26 )
by Andreas
28s queued 20s
created

SettingImConvert   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 21
rs 10
c 0
b 0
f 0
wmc 6
lcom 1
cbo 1

1 Method

Rating   Name   Duplication   Size   Complexity  
B update() 0 17 6
1
<?php
2
3
namespace dokuwiki\plugin\config\core\Setting;
4
5
/**
6
 * Class setting_im_convert
7
 */
8
class SettingImConvert extends SettingString {
9
10
    /** @inheritdoc */
11
    public function update($input) {
12
        if($this->isProtected()) return false;
13
14
        $input = trim($input);
15
16
        $value = is_null($this->local) ? $this->default : $this->local;
17
        if($value == $input) return false;
18
19
        if($input && !file_exists($input)) {
20
            $this->error = true;
21
            $this->input = $input;
22
            return false;
23
        }
24
25
        $this->local = $input;
26
        return true;
27
    }
28
}
29