Passed
Push — master ( dd9897...8de557 )
by Smoren
02:06
created

RetrospectiveCheck::execute()   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 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
cc 2
nc 2
nop 2
crap 2
1
<?php
2
3
namespace Smoren\Validator\Structs;
4
5
use Smoren\Validator\Exceptions\ValidationError;
6
use Smoren\Validator\Interfaces\CheckInterface;
7
8
class RetrospectiveCheck implements CheckInterface
9
{
10
    /**
11
     * {@inheritDoc}
12
     *
13
     * @throws ValidationError if there are previous errors
14
     */
15 3
    public function execute($value, array $previousErrors): void
16
    {
17 3
        if (\count($previousErrors)) {
18 3
            throw ValidationError::fromCheckErrors($value, $previousErrors);
19
        }
20
    }
21
22
    /**
23
     * {@inheritDoc}
24
     *
25
     * @return true
26
     */
27
    public function isInterrupting(): bool
28
    {
29
        return true;
30
    }
31
32
    /**
33
     * @param bool $value
34
     *
35
     * @return static
36
     */
37
    public function setInterrupting(bool $value = true): self
38
    {
39
        return $this;
40
    }
41
}
42