InputMaskNumericField   A
last analyzed

Complexity

Total Complexity 32

Size/Duplication

Total Lines 171
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 40
c 1
b 0
f 0
dl 0
loc 171
rs 9.84
wmc 32

32 Methods

Rating   Name   Duplication   Size   Complexity  
A getAutogroup() 0 3 1
A getPrefix() 0 3 1
A setSuffix() 0 3 1
A getNegationSymbol() 0 3 1
A setDigitsOptional() 0 3 1
A setEnforceDigitsOnBlur() 0 3 1
A setGroupSize() 0 3 1
A getEnforceDigitsOnBlur() 0 3 1
A setIntegerDigits() 0 3 1
A getMin() 0 3 1
A setDecimalProtect() 0 3 1
A setValue() 0 3 1
A getDecimalProtect() 0 3 1
A setIntegerOptional() 0 3 1
A getIntegerOptional() 0 3 1
A getAllowMinus() 0 3 1
A performReadonlyTransformation() 0 4 1
A getIntegerDigits() 0 3 1
A getSuffix() 0 3 1
A setAllowMinus() 0 3 1
A setMax() 0 3 1
A __construct() 0 5 1
A setPrefix() 0 3 1
A getDigits() 0 3 1
A getMax() 0 3 1
A setDigits() 0 3 1
A getDigitsOptional() 0 3 1
A applyDefaultNumericOptions() 0 6 1
A setMin() 0 3 1
A setNegationSymbol() 0 3 1
A setAutogroup() 0 3 1
A getGroupSize() 0 3 1
1
<?php
2
3
namespace LeKoala\FormElements;
4
5
/**
6
 * Format numbers
7
 *
8
 * Use CurrencyFormatter to get rules for decimals and grouping separators
9
 *
10
 * @link https://robinherbots.github.io/Inputmask/#/documentation/numeric
11
 */
12
class InputMaskNumericField extends InputMaskField
13
{
14
    use CurrencyFormatter;
15
16
    public function __construct($name, $title = null, $value = null)
17
    {
18
        parent::__construct($name, $title, $value);
19
        $this->setAlias(self::ALIAS_NUMERIC);
20
        $this->applyDefaultNumericOptions();
21
    }
22
23
    public function applyDefaultNumericOptions()
24
    {
25
        $this->setRighAlign(false);
26
        $this->setAutogroup(true);
27
        $this->setGroupSeparator($this->getCurrencyGroupingSeparator());
28
        $this->setRadixPoint($this->getCurrencyDecimalSeparator());
29
    }
30
31
    public function setValue($value, $data = null)
32
    {
33
        return parent::setValue($value, $data);
34
    }
35
36
    /**
37
     * Create a new class for this field
38
     */
39
    public function performReadonlyTransformation()
40
    {
41
        $field = $this->castedCopy(NumericReadonlyField::class);
42
        return $field;
43
    }
44
45
    public function getDigits()
46
    {
47
        return $this->getConfig('digits');
48
    }
49
50
    public function setDigits($value)
51
    {
52
        return $this->setConfig('digits', $value);
53
    }
54
55
    public function getDigitsOptional()
56
    {
57
        return $this->getConfig('digitsOptional');
58
    }
59
60
    public function setDigitsOptional($value)
61
    {
62
        return $this->setConfig('digitsOptional', $value);
63
    }
64
65
    public function getEnforceDigitsOnBlur()
66
    {
67
        return $this->getConfig('enforceDigitsOnBlur');
68
    }
69
70
    public function setEnforceDigitsOnBlur($value)
71
    {
72
        return $this->setConfig('enforceDigitsOnBlur', $value);
73
    }
74
75
    public function getGroupSize()
76
    {
77
        return $this->getConfig('groupSize');
78
    }
79
80
    public function setGroupSize($value)
81
    {
82
        return $this->setConfig('groupSize', $value);
83
    }
84
85
    public function getAutogroup()
86
    {
87
        return $this->getConfig('autoGroup');
88
    }
89
90
    public function setAutogroup($value)
91
    {
92
        return $this->setConfig('autoGroup', $value);
93
    }
94
95
    public function getAllowMinus()
96
    {
97
        return $this->getConfig('allowMinus');
98
    }
99
100
    public function setAllowMinus($value)
101
    {
102
        return $this->setConfig('allowMinus', $value);
103
    }
104
105
    public function getNegationSymbol()
106
    {
107
        return $this->getConfig('negationSymbol');
108
    }
109
110
    public function setNegationSymbol($value)
111
    {
112
        return $this->setConfig('negationSymbol', $value);
113
    }
114
115
    public function getIntegerDigits()
116
    {
117
        return $this->getConfig('integerDigits');
118
    }
119
120
    public function setIntegerDigits($value)
121
    {
122
        return $this->setConfig('integerDigits', $value);
123
    }
124
125
    public function getIntegerOptional()
126
    {
127
        return $this->getConfig('integerOptional');
128
    }
129
130
    public function setIntegerOptional($value)
131
    {
132
        return $this->setConfig('integerOptional', $value);
133
    }
134
135
    public function getPrefix()
136
    {
137
        return $this->getConfig('prefix');
138
    }
139
140
    public function setPrefix($value)
141
    {
142
        return $this->setConfig('prefix', $value);
143
    }
144
145
    public function getSuffix()
146
    {
147
        return $this->getConfig('suffix');
148
    }
149
150
    public function setSuffix($value)
151
    {
152
        return $this->setConfig('suffix', $value);
153
    }
154
155
    public function getDecimalProtect()
156
    {
157
        return $this->getConfig('decimalProtect');
158
    }
159
160
    public function setDecimalProtect($value)
161
    {
162
        return $this->setConfig('decimalProtect', $value);
163
    }
164
165
    public function getMin()
166
    {
167
        return $this->getConfig('min');
168
    }
169
170
    public function setMin($value)
171
    {
172
        return $this->setConfig('min', $value);
173
    }
174
175
    public function getMax()
176
    {
177
        return $this->getConfig('max');
178
    }
179
180
    public function setMax($value)
181
    {
182
        return $this->setConfig('max', $value);
183
    }
184
}
185