Passed
Push — 5.x ( 65a76f...3a1e20 )
by Enjoys
59s queued 13s
created

Range   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 15
c 1
b 0
f 0
dl 0
loc 34
ccs 14
cts 14
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setStep() 0 5 1
A setMax() 0 6 1
A setMin() 0 6 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Enjoys\Forms\Elements;
6
7
use Enjoys\Forms\AttributeFactory;
8
use Enjoys\Forms\Element;
9
use Enjoys\Forms\Interfaces\Descriptionable;
10
use Enjoys\Forms\Interfaces\Ruleable;
11
use Enjoys\Forms\Traits\Description;
12
use Enjoys\Forms\Traits\Rules;
13
use Webmozart\Assert\Assert;
14
15
class Range extends Element implements Ruleable, Descriptionable
16
{
17
    use Description;
18
    use Rules;
19
20
    protected string $type = 'range';
21
22 1
    public function setMin(string|int $min): self
23
    {
24 1
        Assert::numeric($min);
25 1
        $min = (int) $min;
26 1
        $this->setAttr(AttributeFactory::create('min', $min));
27 1
        return $this;
28
    }
29
30
31 1
    public function setMax(int|string $max): self
32
    {
33 1
        Assert::numeric($max);
34 1
        $max = (int) $max;
35 1
        $this->setAttr(AttributeFactory::create('max', $max));
36 1
        return $this;
37
    }
38
39
40
    /**
41
     * @param numeric $step
0 ignored issues
show
Bug introduced by
The type Enjoys\Forms\Elements\numeric was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
42
     * @return $this
43
     */
44 1
    public function setStep(float|int|string $step): self
45
    {
46 1
        Assert::numeric($step);
47 1
        $this->setAttr(AttributeFactory::create('step', $step));
48 1
        return $this;
49
    }
50
}
51