Passed
Push — master ( d3853d...011878 )
by Smoren
02:21
created

BaseRule   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
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 18
ccs 4
cts 4
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A validate() 0 3 1
A execute() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Smoren\Validator\Rules;
6
7
use Smoren\Validator\Exceptions\ValidationSuccessException;
8
use Smoren\Validator\Exceptions\ValidationError;
9
use Smoren\Validator\Interfaces\BaseRuleInterface;
10
use Smoren\Validator\Interfaces\ExecutionResultInterface;
11
use Smoren\Validator\Structs\ExecutionResult;
12
13
abstract class BaseRule implements BaseRuleInterface
14
{
15
    /**
16
     * {@inheritDoc}
17
     */
18 50
    public function validate($value): void
19
    {
20 50
        $this->execute($value);
21
    }
22
23
    /**
24
     * @param mixed $value
25
     *
26
     * @return ExecutionResultInterface
27
     */
28 50
    protected function execute($value): ExecutionResultInterface
29
    {
30 50
        return new ExecutionResult(false);
31
    }
32
}
33