Passed
Pull Request — master (#643)
by
unknown
02:39
created

ObjectWithLabelsProvider   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 11
c 1
b 0
f 0
dl 0
loc 17
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A getValidationPropertyLabels() 0 5 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Validator\Tests\Support\Data;
6
7
use Yiisoft\Validator\Label;
8
use Yiisoft\Validator\LabelsProviderInterface;
9
use Yiisoft\Validator\Rule\Number;
10
use Yiisoft\Validator\Rule\Required;
11
12
final class ObjectWithLabelsProvider implements LabelsProviderInterface
13
{
14
    #[Required(message: '{attribute} cannot be blank.')]
15
    public string $name = '';
16
17
    #[Number(min: 21, lessThanMinMessage: '{attribute} must be no less than {min}.')]
18
    protected int $age = 17;
19
20
    #[Number(max: 100)]
21
    #[Label('test')]
22
    private int $number = 42;
0 ignored issues
show
introduced by
The private property $number is not used, and could be removed.
Loading history...
23
24
    public function getValidationPropertyLabels(): array
25
    {
26
        return [
27
            'name' => 'Имя',
28
            'age' => 'Возраст',
29
        ];
30
    }
31
}
32