* * 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:----CitlxZWL/jmTQp6+5MxOE++w5rvUN/7hHA5lXu9y+QvXrxqTBUt2tTRSDE/y/NJPQvUajPWZkmUfyCSBNSYZX6XdfLb6VGOaRblv2y1rCFBgNri5uYtb0L054V/GJbkMHySjdWACxWoJFjxWmpaWwUrrCMqFSiFB24qbXBguhojRXpE1Ac1s4EJq8MaICbj/EA4OODxSKIW6FrrThQRVAq8wcBgx4otSIkKkUBxStdfINVZeMvfWj1vFu0MQ18m9aXr87/KcoyLlD6/w2Ot0HY2PAEpzhLh0dGuof25nGHR7+thxByi71qqiuhowDCAJeZGTgSgArXPwFzCQGjamUx8D9WiEcb2WzVa8Mn+xKErib11HTtHcTl2zzLJ0N8VfunOeUnwdixZzkToXRxin/pDtolp+CjIXag6ft5mH+W/4GiEIRrOHnmlsgO2ypkMqTK5FxSKNEey0QFqrqBw9ubLPeMSFyWOM4IZiAzRNnX4IyIIL0VB/SIehmWgAnwxcrDOsx422r+naHe/0UPxjVbr8OQk1nsftUQ7ThidL1e+jurAvt7dqq6Nly363hOIlDVRX9LmnuCwXtDewe9A7V9PAcUhtTj5O+jx5+Rq4K1AgAZdIxykwCxhNEh3qWiUv6JvC/PF9QWoUczOgxZnYJo0f+1fY6scVdM+vCzPZvXw=----ATTACHMENT:----NzY5ODIzMzc5NDAwNzUzNCA0MDU1NDgxNzA3NzEwNzczIDY1MTkyNTc2OTIwNzkwMTU=