Passed
Push — master ( ce7b1b...4d0c94 )
by
unknown
03:04
created

EachDto   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 21
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A validate() 0 9 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Validator\Tests\TestEnvironments\Support\Data;
6
7
use Yiisoft\Validator\Result;
8
use Yiisoft\Validator\Rule\Callback;
9
use Yiisoft\Validator\Rule\Each;
10
11
#[Each([
12
    new Callback(method: 'validate'),
13
])]
14
final class EachDto
15
{
16
    public function __construct(
17
        public int $a,
18
        public int $b,
19
        public int $c,
20
    ) {
21
    }
22
23
    private function validate(int $value): Result
0 ignored issues
show
Unused Code introduced by
The method validate() is not used, and could be removed.

This check looks for private methods that have been defined, but are not used inside the class.

Loading history...
24
    {
25
        $result = new Result();
26
27
        if ($value !== 0) {
28
            $result->addError('Value must be zero.');
29
        }
30
31
        return $result;
32
    }
33
}
34