Conditions | 7 |
Paths | 6 |
Total Lines | 23 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
20 | public function process(ContainerBuilder $container) |
||
21 | { |
||
22 | $dispatcher = $container->getDefinition(Utility::getAliasedName('event_dispatcher')); |
||
23 | |||
24 | $sortFunc = function ($a, $b) { |
||
25 | $a = isset($a['priority']) ? (Integer) $a['priority'] : 0; |
||
26 | $b = isset($b['priority']) ? (Integer) $b['priority'] : 0; |
||
27 | |||
28 | return $a > $b ? -1 : 1; |
||
29 | }; |
||
30 | |||
31 | $tagged = $container->findTaggedServiceIds(Utility::getAliasedName('event_subscriber')); |
||
32 | $subscribers = []; |
||
33 | foreach ($tagged as $id => $tags) { |
||
34 | foreach ($tags as $attributes) { |
||
35 | $subscribers[$id] = $attributes; |
||
36 | } |
||
37 | } |
||
38 | uasort($subscribers, $sortFunc); |
||
39 | foreach ($subscribers as $id => $attrs) { |
||
40 | $dispatcher->addMethodCall('addSubscriber', [new Reference($id)]); |
||
41 | } |
||
42 | } |
||
43 | } |
||
44 |