ProviderProvider   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 2 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
/**
10
 * @implements ProviderInterface<mixed>
11
 * @template T of object
12
 */
13
final class ProviderProvider implements ProviderInterface
14
{
15
    /** @param Set<T> $set */
16
    public function __construct(private InjectorInterface $injector, private Set $set)
17
    {
18
    }
19
20
    /** @return mixed */
21
    public function get()
22
    {
23
        return $this->injector->getInstance($this->set->interface, $this->set->name);
24
    }
25
}
26