Passed
Pull Request — 2.x (#291)
by Akihito
02:21
created

ProviderProvider::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
dl 0
loc 4
rs 10
c 1
b 0
f 0
cc 1
nc 1
nop 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Ray\Di;
6
7
use Ray\Di\Di\Set;
8
9
/** @implements ProviderInterface<mixed> */
10
final class ProviderProvider implements ProviderInterface
11
{
12
    /** @var InjectorInterface  */
13
    private $injector;
14
15
    /** @var Set<object> */
16
    private $set;
17
18
    /** @param Set<object> $set */
19
    public function __construct(InjectorInterface $injector, Set $set)
20
    {
21
        $this->injector = $injector;
22
        $this->set = $set;
23
    }
24
25
    /** @return mixed */
26
    public function get()
27
    {
28
        return $this->injector->getInstance($this->set->interface, $this->set->name);
29
    }
30
}
31