Passed
Push — master ( bfac15...293213 )
by Chema
01:31 queued 16s
created

ConfigResolver::resolve()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2.032

Importance

Changes 0
Metric Value
cc 2
eloc 4
nc 2
nop 1
dl 0
loc 10
ccs 4
cts 5
cp 0.8
crap 2.032
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Gacela\Framework\ClassResolver\Config;
6
7
use Gacela\Framework\AbstractConfig;
8
use Gacela\Framework\ClassResolver\AbstractClassResolver;
9
10
final class ConfigResolver extends AbstractClassResolver
11
{
12
    public const TYPE = 'Config';
13
14
    /**
15
     * @param object|class-string $caller
0 ignored issues
show
Documentation Bug introduced by
The doc comment object|class-string at position 2 could not be parsed: Unknown type name 'class-string' at position 2 in object|class-string.
Loading history...
16
     *
17
     * @throws ConfigNotFoundException
18
     */
19 13
    public function resolve($caller): AbstractConfig
20
    {
21
        /** @var ?AbstractConfig $resolved */
22 13
        $resolved = $this->doResolve($caller);
23
24 13
        if ($resolved === null) {
25
            throw new ConfigNotFoundException($caller);
26
        }
27
28 13
        return $resolved;
29
    }
30
31 13
    protected function getResolvableType(): string
32
    {
33 13
        return self::TYPE;
34
    }
35
}
36