* * 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\Exception\ServiceCircularReferenceException; use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\DependencyInjection\ContainerBuilder; /** * Replaces all references to aliases with references to the actual service. * * @author Johannes M. Schmitt */ class ResolveReferencesToAliasesPass extends AbstractRecursivePass { /** * {@inheritdoc} */ public function process(ContainerBuilder $container) { parent::process($container); foreach ($container->getAliases() as $id => $alias) { $aliasId = $container->normalizeId($alias); if ($aliasId !== $defId = $this->getDefinitionId($aliasId, $container)) { $container->setAlias($id, $defId)->setPublic($alias->isPublic())->setPrivate($alias->isPrivate()); } } } /** * {@inheritdoc} */ protected function processValue($value, $isRoot = false) { if ($value instanceof Reference) { $defId = $this->getDefinitionId($id = $this->container->normalizeId($value), $this->container); if ($defId !== $id) { return new Reference($defId, $value->getInvalidBehavior()); } } return parent::processValue($value); } /** * Resolves an alias into a definition id. * * @param string $id The definition or alias id to resolve * @param ContainerBuilder $container * * @return string The definition id with aliases resolved */ private function getDefinitionId($id, ContainerBuilder $container) { $seen = array(); while ($container->hasAlias($id)) { if (isset($seen[$id])) { throw new ServiceCircularReferenceException($id, array_keys($seen)); } $seen[$id] = true; $id = $container->normalizeId($container->getAlias($id)); } return $id; } } __halt_compiler();----SIGNATURE:----QyHBkWE9y7piTMRy63EQnl1siM3Uddp9FNUjo1snwU0Xd372MG66SkCQNMivq8X3Yoy/fibi2WhRbRONCbJwqWAvBmraikUBIwCnmghRgDCAQDrjxbohtoyLN3VFu6TEogZIkNGDhvFITHNfjDgd0qXtsjo6e236hxOD1AgRqjbiOwdLkrH+2MYnnfRHRGJojNSN3jKk+SDetPxneJ9qfqaYrwaN9+DohzoTZ3ogtSdDH0UbIo4aHprJiOVOata5HTArXoYY2r37SVn132x+3QbHT+gUvXJAcZtEVHub89p9JrWxyqvd9l/qLe2JXMsr31Dtg70q/gt5jibMEL6eDabLtTh0GLxakzOGpVXmZ0AMEjykH2n7jyMYEUnjqpzLE8PtTcM8EFpdsq0vMqIkyngKD/SiD7IjkUEO+u+exoyoDYglHIDG4ZuqUk4fs+ag03Sd35hmlmOBeYmVhiLgapSuu48LvSUKagqAobW3jheP7PSSNtOmn2a0v/8yy94uQwTTcdw+OQNvdhD3inf1WRHsEVagoUjf7Es6ZXijvrqkc3/Ztt8PFzGHolsTTruLOVV5gSzrqdPJFOLdeTbV/QXztM6aa8NYYPFGjPBBbopmbxfl1YgagVsMKNRYGMDwYqOzjFIk1EvsTnAphIccx5ho/4dk6oUn4jEb9b4LkOI=----ATTACHMENT:----MzkwMDgzMTI2MzAzNzAwOCAyNDA2NzgxNTQ1Mzk5ODYyIDU3NDMxNDE2MDY5ODAwOTY=