Passed
Push — master ( 4a3edd...e1b32a )
by Thomas
03:34 queued 01:45
created

NumberField::steps()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 6
c 0
b 0
f 0
ccs 0
cts 5
cp 0
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
crap 2
1
<?php
2
3
namespace Webfactor\Laravel\Backpack\FluentSyntax\Fields;
4
5
use Webfactor\Laravel\Backpack\FluentSyntax\Contracts\CrudFieldAbstract;
6
use Webfactor\Laravel\Backpack\FluentSyntax\Traits\Defaultable;
7
use Webfactor\Laravel\Backpack\FluentSyntax\Traits\Hintable;
8
use Webfactor\Laravel\Backpack\FluentSyntax\Traits\Prefixable;
9
use Webfactor\Laravel\Backpack\FluentSyntax\Traits\Suffixable;
10
11
class NumberField extends CrudFieldAbstract
12
{
13
    use Prefixable, Suffixable, Hintable, Defaultable;
14
15
    protected $type = 'number';
16
17
    public function allowDecimals()
18
    {
19
        $this->options['attributes']['step'] = 'any';
20
21
        return $this;
22
    }
23
24
    public function steps(int $steps)
25
    {
26
        $this->options['attributes']['step'] = $steps;
27
28
        return $this;
29
    }
30
}
31