| Total Complexity | 4 |
| Total Lines | 44 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 9 | class InteropServiceProviderBridgeBundle extends Bundle implements RegistryProviderInterface |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * @var array |
||
| 13 | */ |
||
| 14 | private $serviceProviders; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * @var int |
||
| 18 | */ |
||
| 19 | private $id; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * @param array $serviceProviders An array of service providers, in the format specified in bnf/service-provider-registry: https://github.com/bnf/service-provider-registry#how-does-it-work |
||
| 23 | */ |
||
| 24 | public function __construct(array $serviceProviders = [], int $id = 0) |
||
| 25 | { |
||
| 26 | $this->serviceProviders = $serviceProviders; |
||
| 27 | $this->id = $id; |
||
| 28 | } |
||
| 29 | |||
| 30 | public function build(ContainerBuilder $container) |
||
| 31 | { |
||
| 32 | parent::build($container); |
||
| 33 | $container->addCompilerPass(new ServiceProviderCompilationPass($this->id, $this)); |
||
| 34 | } |
||
| 35 | |||
| 36 | /** |
||
| 37 | * At boot time, let's fill the container with the registry. |
||
| 38 | */ |
||
| 39 | public function boot() |
||
| 40 | { |
||
| 41 | $registryServiceName = 'service_provider_registry_' . $this->id; |
||
| 42 | $this->container->set($registryServiceName, $this->getRegistry($this->container)); |
||
| 43 | } |
||
| 44 | |||
| 45 | /** |
||
| 46 | * @param ContainerInterface $container |
||
| 47 | * @return Registry |
||
| 48 | */ |
||
| 49 | public function getRegistry(ContainerInterface $container): Registry |
||
| 53 | } |
||
| 54 | } |
||
| 55 |