| Total Complexity | 7 |
| Total Lines | 34 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 10 | class Strategy implements ContainerInterface |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * @var ContainerInterface[] |
||
| 14 | */ |
||
| 15 | private $providers; |
||
| 16 | |||
| 17 | 9 | public function __construct(ContainerInterface ...$provider) |
|
| 18 | { |
||
| 19 | 9 | $this->providers = $provider; |
|
| 20 | 9 | } |
|
| 21 | |||
| 22 | 6 | public function get($id) |
|
| 23 | { |
||
| 24 | 6 | $provider = $this->findProvider($id); |
|
| 25 | 6 | if ($provider === null) { |
|
| 26 | 3 | throw new ProviderNotFound($id); |
|
| 27 | } |
||
| 28 | 3 | return $provider->get($id); |
|
| 29 | } |
||
| 30 | |||
| 31 | 3 | public function has($id): bool |
|
| 34 | } |
||
| 35 | |||
| 36 | 9 | private function findProvider(string $id): ?ContainerInterface |
|
| 44 | } |
||
| 45 | } |
||
| 46 |