Mercurial > hg > isophonics-drupal-site
comparison vendor/symfony/console/DependencyInjection/AddConsoleCommandPass.php @ 17:129ea1e6d783
Update, including to Drupal core 8.6.10
author | Chris Cannam |
---|---|
date | Thu, 28 Feb 2019 13:21:36 +0000 |
parents | 1fec387a4317 |
children |
comparison
equal
deleted
inserted
replaced
16:c2387f117808 | 17:129ea1e6d783 |
---|---|
36 } | 36 } |
37 | 37 |
38 public function process(ContainerBuilder $container) | 38 public function process(ContainerBuilder $container) |
39 { | 39 { |
40 $commandServices = $container->findTaggedServiceIds($this->commandTag, true); | 40 $commandServices = $container->findTaggedServiceIds($this->commandTag, true); |
41 $lazyCommandMap = array(); | 41 $lazyCommandMap = []; |
42 $lazyCommandRefs = array(); | 42 $lazyCommandRefs = []; |
43 $serviceIds = array(); | 43 $serviceIds = []; |
44 $lazyServiceIds = array(); | 44 $lazyServiceIds = []; |
45 | 45 |
46 foreach ($commandServices as $id => $tags) { | 46 foreach ($commandServices as $id => $tags) { |
47 $definition = $container->getDefinition($id); | 47 $definition = $container->getDefinition($id); |
48 $class = $container->getParameterBag()->resolveValue($definition->getClass()); | 48 $class = $container->getParameterBag()->resolveValue($definition->getClass()); |
49 | 49 |
77 $serviceIds[$commandId] = $id; | 77 $serviceIds[$commandId] = $id; |
78 $lazyServiceIds[$id] = true; | 78 $lazyServiceIds[$id] = true; |
79 unset($tags[0]); | 79 unset($tags[0]); |
80 $lazyCommandMap[$commandName] = $id; | 80 $lazyCommandMap[$commandName] = $id; |
81 $lazyCommandRefs[$id] = new TypedReference($id, $class); | 81 $lazyCommandRefs[$id] = new TypedReference($id, $class); |
82 $aliases = array(); | 82 $aliases = []; |
83 | 83 |
84 foreach ($tags as $tag) { | 84 foreach ($tags as $tag) { |
85 if (isset($tag['command'])) { | 85 if (isset($tag['command'])) { |
86 $aliases[] = $tag['command']; | 86 $aliases[] = $tag['command']; |
87 $lazyCommandMap[$tag['command']] = $id; | 87 $lazyCommandMap[$tag['command']] = $id; |
88 } | 88 } |
89 } | 89 } |
90 | 90 |
91 $definition->addMethodCall('setName', array($commandName)); | 91 $definition->addMethodCall('setName', [$commandName]); |
92 | 92 |
93 if ($aliases) { | 93 if ($aliases) { |
94 $definition->addMethodCall('setAliases', array($aliases)); | 94 $definition->addMethodCall('setAliases', [$aliases]); |
95 } | 95 } |
96 } | 96 } |
97 | 97 |
98 $container | 98 $container |
99 ->register($this->commandLoaderServiceId, ContainerCommandLoader::class) | 99 ->register($this->commandLoaderServiceId, ContainerCommandLoader::class) |
100 ->setPublic(true) | 100 ->setPublic(true) |
101 ->setArguments(array(ServiceLocatorTagPass::register($container, $lazyCommandRefs), $lazyCommandMap)); | 101 ->setArguments([ServiceLocatorTagPass::register($container, $lazyCommandRefs), $lazyCommandMap]); |
102 | 102 |
103 $container->setParameter('console.command.ids', $serviceIds); | 103 $container->setParameter('console.command.ids', $serviceIds); |
104 $container->setParameter('console.lazy_command.ids', $lazyServiceIds); | 104 $container->setParameter('console.lazy_command.ids', $lazyServiceIds); |
105 } | 105 } |
106 } | 106 } |