Passed
Push — provider-serialisable ( f6f39e...4a5009 )
by Akihito
10:38
created

ProviderProvider   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 7
dl 0
loc 20
rs 10
c 1
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A get() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Ray\Di;
6
7
use Ray\Di\Di\Set;
8
9
final class ProviderProvider implements ProviderInterface
10
{
11
    /** @var InjectorInterface  */
12
    private $injector;
13
14
    /** @var InjectorInterface */
15
    private $interface;
16
17
    /** @var Set */
18
    private $set;
19
20
    public function __construct(InjectorInterface $injector, Set $set)
21
    {
22
        $this->injector = $injector;
23
        $this->set = $set;
24
    }
25
26
    public function get()
27
    {
28
        return $this->injector->getInstance($this->set->interface, $this->set->name);
29
    }
30
}
31