Passed
Push — main ( 03d0aa...06b87c )
by Stanislav
02:17
created

ArgumentResolver   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 21
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A resolve() 0 12 2
1
<?php declare(strict_types=1);
2
3
namespace Diezz\YamlToObjectMapper\Resolver;
4
5
abstract class ArgumentResolver
6
{
7
    protected bool $isResolved = false;
8
    protected mixed $resolvedValue = null;
9
    protected ?ArgumentResolver $after = null;
10
11 8
    public function resolve($context = null): mixed
12
    {
13 8
        if ($this->isResolved) {
14 6
            return $this->resolvedValue;
15
        }
16
17 8
        $result = $this->doResolve($context);
18
19 8
        $this->resolvedValue = $result;
20 8
        $this->isResolved = true;
21
22 8
        return $result;
23
    }
24
25
    abstract protected function doResolve($context = null);
26
}
27