Passed
Pull Request — master (#331)
by Sergei
02:46
created

SkipOnErrorTrait   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 5
dl 0
loc 12
ccs 6
cts 6
cp 1
rs 10
c 1
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A shouldSkipOnError() 0 3 1
A skipOnError() 0 5 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Validator\Rule\Trait;
6
7
trait SkipOnErrorTrait
8
{
9 1
    public function skipOnError(bool $value): static
10
    {
11 1
        $new = clone $this;
12 1
        $new->skipOnError = $value;
0 ignored issues
show
Bug Best Practice introduced by
The property skipOnError does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
13 1
        return $new;
14
    }
15
16 117
    public function shouldSkipOnError(): bool
17
    {
18 117
        return $this->skipOnError;
19
    }
20
}
21