Test Failed
Push — adopt ( 6aaadb )
by Sergei
07:51
created

DependencyResolver   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 4
Bugs 0 Features 0
Metric Value
eloc 5
c 4
b 0
f 0
dl 0
loc 25
ccs 5
cts 5
cp 1
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A resolve() 0 3 1
A resolveReference() 0 3 1
A __construct() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Di;
6
7
use Psr\Container\ContainerExceptionInterface;
8
use Psr\Container\ContainerInterface;
9
use Psr\Container\NotFoundExceptionInterface;
10
use Yiisoft\Definitions\Contract\DependencyResolverInterface;
11
12
/**
13
 * @internal
14
 */
15
final class DependencyResolver implements DependencyResolverInterface
16
{
17
    private ContainerInterface $container;
18
19
    public function __construct(ContainerInterface $container)
20
    {
21 81
        $this->container = $container;
22
    }
23 81
24 81
    /**
25
     * @throws NotFoundExceptionInterface
26
     * @throws ContainerExceptionInterface
27
     *
28
     * @return mixed|object
29
     *
30
     * @psalm-suppress InvalidThrow
31
     */
32
    public function resolve(string $id)
33
    {
34
        return $this->container->get($id);
35
    }
36 55
37
    public function resolveReference(string $id)
38 55
    {
39
        return $this->resolve($id);
40
    }
41
}
42