* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Serializer\DependencyInjection; use Symfony\Component\DependencyInjection\Compiler\PriorityTaggedServiceTrait; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; use Symfony\Component\DependencyInjection\Exception\RuntimeException; /** * Adds all services with the tags "serializer.encoder" and "serializer.normalizer" as * encoders and normalizers to the "serializer" service. * * @author Javier Lopez * @author Robin Chalas */ class SerializerPass implements CompilerPassInterface { use PriorityTaggedServiceTrait; private $serializerService; private $normalizerTag; private $encoderTag; public function __construct($serializerService = 'serializer', $normalizerTag = 'serializer.normalizer', $encoderTag = 'serializer.encoder') { $this->serializerService = $serializerService; $this->normalizerTag = $normalizerTag; $this->encoderTag = $encoderTag; } public function process(ContainerBuilder $container) { if (!$container->hasDefinition($this->serializerService)) { return; } if (!$normalizers = $this->findAndSortTaggedServices($this->normalizerTag, $container)) { throw new RuntimeException(sprintf('You must tag at least one service as "%s" to use the "%s" service.', $this->normalizerTag, $this->serializerService)); } $serializerDefinition = $container->getDefinition($this->serializerService); $serializerDefinition->replaceArgument(0, $normalizers); if (!$encoders = $this->findAndSortTaggedServices($this->encoderTag, $container)) { throw new RuntimeException(sprintf('You must tag at least one service as "%s" to use the "%s" service.', $this->encoderTag, $this->serializerService)); } $serializerDefinition->replaceArgument(1, $encoders); } } __halt_compiler();----SIGNATURE:----VecFhitYWIP6Coc+U3Q3gh6SSVdLc0EYxiDG3Xb5ZFcpeDcm0BrVt2imxb9gTN2qAvhlNv3W+mDUB/BkH9FNkwIUEs7CGpxiJ/ngcfrPBkIqlSqmuaXsaC2gdbd45nc0rhlJzuO1Ii55qTL2BqNtHtEhpfZFT9QlhWikOm4dMR2qkYqfgRtroRxF774xapU2yKkvs6jfUZ92qAIMZ2Ip3Co+uRcCPYayYeJFsL0syLi/AjG3C49Rd5J84SF0jP2zs1tZ4lw6N/Nk7Bu6YCEjlpBS8cCnd4GY609BGEiuBg5W/350PZITUqNYiBvjJeos8OfDp0OBdB4m7w2XibYb3XuK9swcaBrETUq6FvaNmg9n6yKiGDaR6kb1nOg0QPEOcaUIL5LVkvQIfJ8IK2Y3Gk8erhFv2F2K+X1VGZpVyxiy5G5q17/pu6oauagYnx0CXbkgFWWRH42H0FNLOZH3zWdcbl8+EMLlCNyglE7cKI9OnbOKKGJ1/5Bdwd0RtmksLlwa/rCQg3Po1ZCvPJQKoyu/2cg1+6qtrk2IfvRtiIpeREl5LK4SOsepizKyEXE3lfJAkcNg+1vvsBxwCvTrTQxGmBLuwfDJ6f7Fu0zfr2h+j00T3E07rW2kbbooO4mVxMS/utH9yhVirwUG58qYFzzxt4VNz6ITTzEA8sBqefE=----ATTACHMENT:----NzgwMjA2MDUwMzMzNTAzNiA1NTMzNDkwMjMwMjU2NTIwIDkzMDg3NDMzOTU5ODUyNjM=