ObjectWithRulesProvider   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 15
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A getRules() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Validator\Tests\Support\Data;
6
7
use Yiisoft\Validator\Rule\Equal;
8
use Yiisoft\Validator\Rule\Number;
9
use Yiisoft\Validator\Rule\Required;
10
use Yiisoft\Validator\RulesProviderInterface;
11
12
final class ObjectWithRulesProvider implements RulesProviderInterface
13
{
14
    #[Required]
15
    public string $name = '';
16
17
    #[Number(min: 21)]
18
    protected int $age = 17;
19
20
    #[Number(max: 100)]
21
    private int $number = 42;
0 ignored issues
show
introduced by
The private property $number is not used, and could be removed.
Loading history...
22
23
    public function getRules(): iterable
24
    {
25
        return [
26
            'age' => [new Required(), new Equal(25)],
27
        ];
28
    }
29
}
30