* * 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:----ktYvupdk4v0tyzxamzi1uOmAG/5rkqlQRsCz4pAuemuzgddct59VHL8OOv/7QTNh108lTVaiorfN6gTTTqVasN3Co3WE97SaxouM8UgEq7hhWIxHbYdbN9D0WIJ9Fa9L+n9s01tgO/S4PQd21GIaeNSjsBZZbqJEbKXSnDvXVgoX9qqoSIW83mPllWQhG06gsUlP50VFXJVP+0v8l4E2QAPdvMq+Dr/3Sd2LA7y0CpiRjtEbMioysr/4uJI2sl5kKkxipxXr140cSZX/5lsVpvhIIxCksJ8WhIlOkfQYB5ADASIkoVksf8HQaPr05NVw/2NhNGlGEIR0c3Frw44k0SRgEdgS7oX1WgpdorOHPWNd/K4wv98vesLuZ2Wd82ENdGDYX7TjZYSXj8yJVL8Z4ZAJi7FX60FbS2zThBcfpJsyr2k2ALyksaQ+zsfv/wilxRk2u6fsrtRyCuaW8pGRLdgSprMHQtnZSLaojJU8lTh90E0AwbwdEHT5CUuHTeBfA/WmcSrepqcZHNRqm3bVrD8gc8mXFuv7dCsa3kpKHwVsgFGmWevaihuMM53p6DSA154/lddrfj3SYTF6lq6FshBrCCJW35qQyinEwqeDmui6F/PN9SAo0AbyK6euryv2bLSw1r09Q83CQYCb4xx9S/+iF2mrBkwerFhzxPU43eU=----ATTACHMENT:----NDc1OTExMTY1MzY0OTU1MyA0OTIwNzcyNDkyNTAyNTkgNTM3NTcyMDIxMjUwNjkz