Total Complexity | 4 |
Total Lines | 25 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 2 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
7 | class Proxy extends Binding |
||
8 | { |
||
9 | /** |
||
10 | * @param class-string $interface |
||
|
|||
11 | */ |
||
12 | 7 | public function __construct( |
|
13 | protected readonly string $interface, |
||
14 | public readonly bool $singleton = false, |
||
15 | ) { |
||
16 | 7 | if (!\interface_exists($interface)) { |
|
17 | 1 | throw new \InvalidArgumentException(\sprintf('Interface `%s` does not exist.', $interface)); |
|
18 | } |
||
19 | } |
||
20 | |||
21 | 1 | public function __toString(): string |
|
22 | { |
||
23 | 1 | return \sprintf('Proxy to `%s`', $this->interface); |
|
24 | } |
||
25 | |||
26 | /** |
||
27 | * @return class-string |
||
28 | */ |
||
29 | 4 | public function getInterface(): string |
|
32 | } |
||
33 | } |
||
34 |