Conditions | 5 |
Paths | 5 |
Total Lines | 24 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
15 | */ |
||
16 | public function process(ContainerBuilder $container) |
||
17 | { |
||
18 | $managerId = 'as3_post_process.task.manager'; |
||
19 | if (!$container->hasDefinition($managerId)) { |
||
20 | return; |
||
21 | } |
||
22 | // Get the manager service definition |
||
23 | $definition = $container->getDefinition($managerId); |
||
24 | |||
25 | // Get the tagged tasks |
||
26 | $tag = 'as3_post_process.task'; |
||
27 | $tasks = $container->findTaggedServiceIds($tag); |
||
28 | |||
29 | foreach ($tasks as $id => $tagAttributes) { |
||
30 | foreach ($tagAttributes as $attributes) { |
||
31 | // Add the task to the manager service definition |
||
32 | $priority = isset($attributes['priority']) ? $attributes['priority'] : 0; |
||
33 | $definition->addMethodCall( |
||
34 | 'addTask', |
||
35 | [new Reference($id), $priority] |
||
36 | ); |
||
37 | } |
||
38 | } |
||
39 | } |
||
41 |