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

ConfigResolver   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Test Coverage

Coverage 85.71%

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 24
ccs 6
cts 7
cp 0.8571
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getResolvableType() 0 3 1
A resolve() 0 10 2
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