Total Complexity | 6 |
Total Lines | 53 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
10 | final class MultiBinder |
||
11 | { |
||
12 | /** @var Container */ |
||
13 | private $container; |
||
14 | |||
15 | /** @var array<string, array<int|string, Lazy<object>>> */ |
||
|
|||
16 | private $lazyCollection = []; |
||
17 | |||
18 | /** @var string */ |
||
19 | private $interface; |
||
20 | |||
21 | private function __construct(AbstractModule $module, string $interface) |
||
25 | } |
||
26 | |||
27 | public static function newInstance(AbstractModule $module, string $interface): self |
||
28 | { |
||
29 | return new self($module, $interface); |
||
30 | } |
||
31 | |||
32 | /** |
||
33 | * @param class-string $class |
||
34 | */ |
||
35 | public function add(string $class, ?string $key = null): void |
||
40 | } |
||
41 | |||
42 | /** |
||
43 | * @param class-string $class |
||
44 | */ |
||
45 | public function set(string $class, ?string $key = null): void |
||
46 | { |
||
47 | unset($this->lazyCollection[$this->interface]); |
||
48 | $this->add($class, $key); |
||
49 | } |
||
50 | |||
51 | /** |
||
52 | * @param class-string $class |
||
53 | */ |
||
54 | private function bind(string $class, ?string $key): void |
||
63 | } |
||
64 | } |
||
65 |