Completed
Push — master ( 48ff0c...a157cb )
by wen
03:02
created

Number::setStep()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
c 0
b 0
f 0
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
3
namespace Sco\Admin\Form\Elements;
4
5
class Number extends NamedElement
6
{
7
    protected $type = 'number';
8
9
    protected $max;
10
    protected $min  = 0;
11
    protected $step = 1;
12
13
    public function getMax()
14
    {
15
        return $this->max;
16
    }
17
18
    public function setMax($value)
19
    {
20
        $this->max = (int)$value;
21
22
        return $this;
23
    }
24
25
    public function getMin()
26
    {
27
        return $this->min;
28
    }
29
30
    public function setMin($value)
31
    {
32
        $this->min = (int)$value;
33
34
        return $this;
35
    }
36
37
    public function setStep($value)
38
    {
39
        $this->step = (int)$value;
40
41
        return $this;
42
    }
43
44
    public function toArray()
45
    {
46
        return parent::toArray() + [
47
                'min'      => $this->getMin(),
48
                'max'      => $this->getMax(),
49
                'step'     => $this->step,
50
            ];
51
    }
52
}
53