Test Failed
Push — master ( 180f30...aa27d2 )
by Terzi
04:24
created

Number::min()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 5
ccs 0
cts 0
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Terranet\Administrator\Field;
4
5
class Number extends Field
6
{
7
    /** @var int */
8
    protected $min = 0;
9
10
    /** @var null|int */
11
    protected $max = null;
12
13
    /** @var int|double */
14
    protected $step = 1;
15
16
    /**
17
     * @param  int  $min
18
     * @return $this
19
     */
20
    public function min(int $min): self
21
    {
22
        $this->min = $min;
23
24
        return $this;
25
    }
26
27
    /**
28
     * @param  null|int  $max
29
     * @return $this
30
     */
31
    public function max(?int $max): self
32
    {
33
        $this->max = $max;
34
35
        return $this;
36
    }
37
38
    /**
39
     * @param  float|int  $step
40
     * @return $this
41
     */
42
    public function step($step): self
43
    {
44
        $this->step = $step;
45
46
        return $this;
47
    }
48
49
    /**
50
     * @return array
51
     */
52
    public function getAttributes(): array
53
    {
54
        return parent::getAttributes() + [
55
                'min' => $this->min,
56
                'max' => $this->max,
57
                'step' => $this->step,
58
                'style' => 'width: 150px',
59
            ];
60
    }
61
}
62