Passed
Push — master ( acac4e...709c88 )
by Alexander
03:10
created

DependencyResolver::resolve()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
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 88
    public function __construct(ContainerInterface $container)
20
    {
21 88
        $this->container = $container;
22 88
    }
23
24
    /**
25
     * @throws NotFoundExceptionInterface
26
     * @throws ContainerExceptionInterface
27
     *
28
     * @return mixed|object
29
     *
30
     * @psalm-suppress InvalidThrow
31
     */
32 54
    public function resolve(string $id)
33
    {
34 54
        return $this->container->get($id);
35
    }
36
37 41
    public function resolveReference(string $id)
38
    {
39 41
        return $this->resolve($id);
40
    }
41
}
42