bearsunday /
BEAR.Sunday
| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | namespace BEAR\Sunday\Module\Constant; |
||
| 6 | |||
| 7 | use Override; |
||
| 8 | use Ray\Di\AbstractModule; |
||
| 9 | |||
| 10 | final class NamedModule extends AbstractModule |
||
| 11 | { |
||
| 12 | /** @param array<non-empty-string, string> $names */ |
||
|
0 ignored issues
–
show
Documentation
Bug
introduced
by
Loading history...
|
|||
| 13 | public function __construct( |
||
| 14 | private array $names, |
||
| 15 | ) { |
||
| 16 | parent::__construct(); |
||
| 17 | } |
||
| 18 | |||
| 19 | #[Override] |
||
| 20 | protected function configure(): void |
||
| 21 | { |
||
| 22 | foreach ($this->names as $annotatedWith => $instance) { |
||
| 23 | $this->bind()->annotatedWith($annotatedWith)->toInstance($instance); |
||
| 24 | } |
||
| 25 | } |
||
| 26 | } |
||
| 27 |