|
12 | 12 | namespace Symfony\Bundle\FrameworkBundle\Console\Descriptor; |
13 | 13 |
|
14 | 14 | use Symfony\Component\DependencyInjection\Alias; |
| 15 | +use Symfony\Component\DependencyInjection\Argument\ArgumentInterface; |
15 | 16 | use Symfony\Component\DependencyInjection\ContainerBuilder; |
16 | 17 | use Symfony\Component\DependencyInjection\Definition; |
17 | 18 | use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag; |
@@ -227,20 +228,7 @@ private function getContainerDefinitionData(Definition $definition, $omitTags = |
227 | 228 | } |
228 | 229 |
|
229 | 230 | if ($showArguments) { |
230 | | - $data['arguments'] = array(); |
231 | | - |
232 | | - foreach ($definition->getArguments() as $argument) { |
233 | | - if ($argument instanceof Reference) { |
234 | | - $data['arguments'][] = array( |
235 | | - 'type' => 'service', |
236 | | - 'id' => (string) $argument, |
237 | | - ); |
238 | | - } elseif ($argument instanceof Definition) { |
239 | | - $data['arguments'][] = $this->getContainerDefinitionData($argument, $omitTags, $showArguments); |
240 | | - } else { |
241 | | - $data['arguments'][] = $argument; |
242 | | - } |
243 | | - } |
| 231 | + $data['arguments'] = $this->describeValue($definition->getArguments(), $omitTags, $showArguments); |
244 | 232 | } |
245 | 233 |
|
246 | 234 | $data['file'] = $definition->getFile(); |
@@ -388,4 +376,33 @@ private function getCallableData($callable, array $options = array()) |
388 | 376 |
|
389 | 377 | throw new \InvalidArgumentException('Callable is not describable.'); |
390 | 378 | } |
| 379 | + |
| 380 | + private function describeValue($value, $omitTags, $showArguments) |
| 381 | + { |
| 382 | + if (is_array($value)) { |
| 383 | + $data = array(); |
| 384 | + foreach ($value as $k => $v) { |
| 385 | + $data[$k] = $this->describeValue($v, $omitTags, $showArguments); |
| 386 | + } |
| 387 | + |
| 388 | + return $data; |
| 389 | + } |
| 390 | + |
| 391 | + if ($value instanceof Reference) { |
| 392 | + return array( |
| 393 | + 'type' => 'service', |
| 394 | + 'id' => (string) $value, |
| 395 | + ); |
| 396 | + } |
| 397 | + |
| 398 | + if ($value instanceof Definition) { |
| 399 | + return $this->getContainerDefinitionData($value, $omitTags, $showArguments); |
| 400 | + } |
| 401 | + |
| 402 | + if ($value instanceof ArgumentInterface) { |
| 403 | + return $this->describeValue($value->getValues(), $omitTags, $showArguments); |
| 404 | + } |
| 405 | + |
| 406 | + return $value; |
| 407 | + } |
391 | 408 | } |
0 commit comments