Container.php
37 lines
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace AC\DI; |
| 6 | |
| 7 | use AC\Vendor; |
| 8 | |
| 9 | /** |
| 10 | * Container wrapper that abstracts the underlying dependency injection container |
| 11 | */ |
| 12 | final class Container implements Vendor\Psr\Container\ContainerInterface, FactoryContainer |
| 13 | { |
| 14 | |
| 15 | private Vendor\DI\Container $container; |
| 16 | |
| 17 | public function __construct(Vendor\DI\Container $container) |
| 18 | { |
| 19 | $this->container = $container; |
| 20 | } |
| 21 | |
| 22 | public function get(string $id) |
| 23 | { |
| 24 | return $this->container->get($id); |
| 25 | } |
| 26 | |
| 27 | public function has(string $id): bool |
| 28 | { |
| 29 | return $this->container->has($id); |
| 30 | } |
| 31 | |
| 32 | public function make(string $id, array $parameters = []) |
| 33 | { |
| 34 | return $this->container->make($id, $parameters); |
| 35 | } |
| 36 | |
| 37 | } |