Passed
Pull Request — master (#281)
by Sergei
02:50
created

PureInputData   A

Complexity

Total Complexity 12

Size/Duplication

Total Lines 65
Duplicated Lines 0 %

Test Coverage

Coverage 92.86%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 16
dl 0
loc 65
ccs 26
cts 28
cp 0.9286
rs 10
c 1
b 0
f 0
wmc 12

12 Methods

Rating   Name   Duplication   Size   Complexity  
A getValidationErrors() 0 3 1
A __construct() 0 4 1
A isValidated() 0 3 1
A getPlaceholder() 0 3 1
A getValue() 0 3 1
A getLabel() 0 3 1
A getId() 0 3 1
A getHint() 0 3 1
A getValidationRules() 0 3 1
A getName() 0 3 1
A withName() 0 5 1
A withValue() 0 5 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Form\Field\Base\InputData;
6
7
final class PureInputData implements InputDataInterface
8
{
9 119
    public function __construct(
10
        private ?string $name = null,
11
        private mixed $value = null,
12
    ) {
13 119
    }
14
15
    public function getValidationRules(): array
16
    {
17
        return [];
18
    }
19
20 2
    public function getName(): ?string
21
    {
22 2
        return $this->name;
23
    }
24
25 2
    public function getValue(): mixed
26
    {
27 2
        return $this->value;
28
    }
29
30 108
    public function getLabel(): ?string
31
    {
32 108
        return null;
33
    }
34
35 108
    public function getHint(): ?string
36
    {
37 108
        return null;
38
    }
39
40 2
    public function getPlaceholder(): ?string
41
    {
42 2
        return null;
43
    }
44
45 8
    public function getId(): ?string
46
    {
47 8
        return null;
48
    }
49
50 2
    public function isValidated(): bool
51
    {
52 2
        return false;
53
    }
54
55 108
    public function getValidationErrors(): array
56
    {
57 108
        return [];
58
    }
59
60 2
    public function withName(?string $name): static
61
    {
62 2
        $new = clone $this;
63 2
        $new->name = $name;
64 2
        return $new;
65
    }
66
67 1
    public function withValue(mixed $value): static
68
    {
69 1
        $new = clone $this;
70 1
        $new->value = $value;
71 1
        return $new;
72
    }
73
}
74