| Conditions | 5 |
| Paths | 9 |
| Total Lines | 22 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 16 | public function process(ContainerBuilder $container) |
||
| 17 | { |
||
| 18 | $shortcodeServices = $container->findTaggedServiceIds('webfactory.shortcode'); |
||
| 19 | |||
| 20 | // add services tagged with webfactory.shortcode as handlers to the short code handler container |
||
| 21 | $handlerContainer = $container->findDefinition(HandlerContainer::class); |
||
| 22 | foreach ($shortcodeServices as $id => $shortcodeTags) { |
||
| 23 | foreach ($shortcodeTags as $shortcodeTag) { |
||
| 24 | $handlerContainer->addMethodCall('add', [$shortcodeTag['shortcode'], new Reference($id)]); |
||
| 25 | } |
||
| 26 | } |
||
| 27 | |||
| 28 | // prepare the GuideController if it's configuration is imported |
||
| 29 | if ($container->has(GuideController::class)) { |
||
| 30 | $allShortcodeTags = []; |
||
| 31 | foreach ($shortcodeServices as $id => $shortcodeTags) { |
||
| 32 | $allShortcodeTags = array_merge($allShortcodeTags, $shortcodeTags); |
||
| 33 | } |
||
| 34 | |||
| 35 | $container |
||
| 36 | ->getDefinition(GuideController::class) |
||
| 37 | ->setArgument(0, $allShortcodeTags); |
||
| 38 | } |
||
| 41 |