* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\DependencyInjection\Compiler; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Reference; /** * Trait that allows a generic method to find and sort service by priority option in the tag. * * @author Iltar van der Berg */ trait PriorityTaggedServiceTrait { /** * Finds all services with the given tag name and order them by their priority. * * The order of additions must be respected for services having the same priority, * and knowing that the \SplPriorityQueue class does not respect the FIFO method, * we should not use that class. * * @see https://bugs.php.net/bug.php?id=53710 * @see https://bugs.php.net/bug.php?id=60926 * * @param string $tagName * @param ContainerBuilder $container * * @return Reference[] */ private function findAndSortTaggedServices($tagName, ContainerBuilder $container) { $services = array(); foreach ($container->findTaggedServiceIds($tagName, true) as $serviceId => $attributes) { $priority = isset($attributes[0]['priority']) ? $attributes[0]['priority'] : 0; $services[$priority][] = new Reference($serviceId); } if ($services) { krsort($services); $services = call_user_func_array('array_merge', $services); } return $services; } } __halt_compiler();----SIGNATURE:----DszHcuRRM8YF6Tgw/iM3mkb8QhExGJ8uo3NnpagIvT9jr9FZRggHwQr4p5EzKTPirD9sG6yQXA9LDjHw9yDVcYfqEx8L/w2YhXJXvfemaRN/HeRLAp6tZBcdh2V5gva6Ek9kOjxxTM8bJ9RXe+sJJ76fs/rXzRvK8VHA5mUBLl1H4fUNPnuKc9eBSfT97/6/lTu2Mo/ZN9yACt67L7zaFBcicQXpx1THcHARdhZnVF7jCmBg+TArR9KLWGjbh2zQZ851sHwjTrlifnORwjo+UQzptqJsbIzEA4MIToLnZntbW2CNGyzJ3PomGPfYB0gB/ovF/OejQP8ywZSAzZd51YFK4uQngIgNwZNxINNlv+tQozMYrPWLyfDD+GvPjhJLRvNQHHgAqeKdiUkfdEN/GkatESFWf+2arc2jhQJb7wmkJ3oIxFWkpkSBIE9MWYwFTDPiGzKLqfC+k4uactVYnOT5jzkfaNymh8rkvMJfxak9h+SNmHg11ZUyXzW0ZjoDTofIDxdkGu/wGAfo8KIbaTb+R4k0JLapr4E1XMwfQ0yJukS17pQULFPnKl95PNj4thncuMlpFQ5XmmRAf+TrSRN7OTdCETc+1kvO54VaMcnuxjDwB/RL66Uac5+LUtaWFHnwneKMbwci5NQU+DWy1xhnYV4geqPUQCCXIIA8hug=----ATTACHMENT:----NDMxNjQ0NzQ5NTY3NDA0MSA5MzcyNTI1NjIzNTY0OTcwIDcwMzAyODU5ODA4MTg5MDE=