| Total Complexity | 4 |
| Total Lines | 28 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 12 | class Autowiring implements ContainerInterface |
||
| 13 | { |
||
| 14 | /** |
||
| 15 | * @var Reflection |
||
| 16 | */ |
||
| 17 | private $reflection; |
||
| 18 | /** |
||
| 19 | * @var ContainerInterface |
||
| 20 | */ |
||
| 21 | private $container; |
||
| 22 | |||
| 23 | public function __construct(Reflection $reflection, ContainerInterface $container) |
||
| 24 | { |
||
| 25 | $this->reflection = $reflection; |
||
| 26 | $this->container = $container; |
||
| 27 | } |
||
| 28 | |||
| 29 | public function get($id) |
||
| 30 | { |
||
| 31 | if (!$this->has($id)) { |
||
| 32 | throw new NotFound($id); |
||
| 33 | } |
||
| 34 | return (new Factory($id, ...$this->reflection->getDependencies($id)))($this->container); |
||
| 35 | } |
||
| 36 | |||
| 37 | public function has($id): bool |
||
| 40 | } |
||
| 41 | } |
||
| 42 |