Passed
Push — master ( bf8929...f56605 )
by Smoren
02:31
created

RetrospectiveCheck::__invoke()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 2
nc 2
nop 3
dl 0
loc 4
ccs 3
cts 3
cp 1
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Smoren\Validator\Checks;
6
7
use Smoren\Validator\Exceptions\CheckError;
8
use Smoren\Validator\Interfaces\UtilityCheckInterface;
9
10
/**
11
 * @internal
12
 */
13
final class RetrospectiveCheck implements UtilityCheckInterface
14
{
15
    /**
16
     * {@inheritDoc}
17
     */
18 6
    public function __invoke($value, array $previousErrors, bool $preventDuplicate = false): void
19
    {
20 6
        if (\count($previousErrors)) {
21 6
            throw new CheckError('retrospective', $value, $previousErrors);
22
        }
23
    }
24
}
25