Passed
Pull Request — master (#300)
by Alexander
06:13 queued 03:06
created

BeforeValidationTrait   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 3
c 1
b 0
f 0
dl 0
loc 15
ccs 4
cts 4
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getWhen() 0 3 1
A shouldSkipOnError() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Validator\Rule\Trait;
6
7
use Closure;
8
use Yiisoft\Validator\ValidationContext;
9
10
trait BeforeValidationTrait
11
{
12 93
    public function shouldSkipOnError(): bool
13
    {
14 93
        return $this->skipOnError;
15
    }
16
17
    /**
18
     * @psalm-return Closure(mixed, ValidationContext):bool|null
19
     *
20
     * @return Closure|null
21
     */
22 92
    public function getWhen(): ?Closure
23
    {
24 92
        return $this->when;
25
    }
26
}
27