Total Complexity | 3 |
Total Lines | 27 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
13 | class PaginatorCompilerPass implements CompilerPassInterface |
||
14 | { |
||
15 | /** |
||
16 | * @param ContainerBuilder $container |
||
17 | * |
||
18 | * @throws \Exception |
||
19 | */ |
||
20 | public function process(ContainerBuilder $container) |
||
21 | { |
||
22 | $providers = []; |
||
23 | $configsProviders = $this->getPaginationConfigs($container); |
||
24 | foreach ($container->findTaggedServiceIds('api_service.pagination_provider') as $id => $configs) { |
||
25 | $provider = $container->getDefinition($id); |
||
26 | $provider->replaceArgument(0, $configsProviders[$configs[0]['provider']] ?? []); |
||
27 | $providers[] = $provider; |
||
28 | } |
||
29 | |||
30 | $pagination = $container->getDefinition('api_service.pagination_provider.chain'); |
||
31 | $pagination->replaceArgument(0, $providers); |
||
32 | } |
||
33 | |||
34 | private function getPaginationConfigs(ContainerBuilder $container) |
||
40 | } |
||
41 | } |
||
42 |