Failed Conditions
Pull Request — psr2 (#2382)
by Andreas
08:02 queued 12s
created

SettingNumericopt   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 1
Bugs 1 Features 0
Metric Value
c 1
b 1
f 0
dl 0
loc 18
rs 10
wmc 3
lcom 1
cbo 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A update() 0 9 3
1
<?php
2
3
namespace dokuwiki\plugin\config\core\Setting;
4
5
/**
6
 * Class setting_numericopt
7
 */
8
class SettingNumericopt extends SettingNumeric {
9
    // just allow an empty config
10
    protected $pattern = '/^(|[-]?[0-9]+(?:[-+*][0-9]+)*)$/';
11
12
    /**
13
     * @inheritdoc
14
     * Empty string is valid for numericopt
15
     */
16
    public function update($input) {
17
        if($input === '') {
18
            if($input == $this->local) return false;
19
            $this->local = $input;
20
            return true;
21
        }
22
23
        return parent::update($input);
24
    }
25
}
26