Passed
Push — master ( 6b3bd5...b249fa )
by Sergei
05:31 queued 02:48
created

PureInputData::getHint()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
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
    /**
10
     * @param string[] $validationErrors
11
     *
12
     * @psalm-param list<string> $validationErrors
13
     */
14 475
    public function __construct(
15
        private ?string $name = null,
16
        private mixed $value = null,
17
        private ?string $label = null,
18
        private ?string $hint = null,
19
        private ?string $placeholder = null,
20
        private ?string $id = null,
21
        private ?array $validationErrors = null,
22
    ) {
23 475
    }
24
25 1
    public function getValidationRules(): mixed
26
    {
27 1
        return null;
28
    }
29
30 123
    public function getName(): ?string
31
    {
32 123
        return $this->name;
33
    }
34
35 291
    public function getValue(): mixed
36
    {
37 291
        return $this->value;
38
    }
39
40 275
    public function getLabel(): ?string
41
    {
42 275
        return $this->label;
43
    }
44
45 424
    public function getHint(): ?string
46
    {
47 424
        return $this->hint;
48
    }
49
50 146
    public function getPlaceholder(): ?string
51
    {
52 146
        return $this->placeholder;
53
    }
54
55 315
    public function getId(): ?string
56
    {
57 315
        return $this->id;
58
    }
59
60 285
    public function isValidated(): bool
61
    {
62 285
        return $this->validationErrors !== null;
63
    }
64
65 445
    public function getValidationErrors(): array
66
    {
67 445
        return $this->validationErrors ?? [];
68
    }
69
}
70