Passed
Push — master ( 0363dc...b69f59 )
by Rustam
02:19
created

BeforeValidationTrait   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A shouldSkipOnEmpty() 0 3 1
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 41
    public function shouldSkipOnEmpty(): bool
13
    {
14 41
        return $this->skipOnEmpty;
15
    }
16
17 38
    public function shouldSkipOnError(): bool
18
    {
19 38
        return $this->skipOnError;
20
    }
21
22
    /**
23
     * @psalm-return Closure(mixed, ValidationContext):bool|null
24
     *
25
     * @return Closure|null
26
     */
27 37
    public function getWhen(): ?Closure
28
    {
29 37
        return $this->when;
30
    }
31
}
32