Skip to content

Commit fb0e153

Browse files
committed
Making the service id jump out with debug:container or debug:types
1 parent 8327a07 commit fb0e153

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php

+5-3
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,10 @@ protected function describeContainerServices(ContainerBuilder $builder, array $o
224224

225225
$tableHeaders = array_merge(array('Service ID'), $tagsNames, array('Class name'));
226226
$tableRows = array();
227+
$rawOutput = isset($options['raw_output']) && $options['raw_output'];
227228
foreach ($this->sortServiceIds($serviceIds) as $serviceId) {
228229
$definition = $this->resolveServiceDefinition($builder, $serviceId);
230+
$styledServiceId = $rawOutput ? $serviceId : sprintf('<fg=cyan>%s</fg=cyan>', $serviceId);
229231
if ($definition instanceof Definition) {
230232
if ($showTag) {
231233
foreach ($definition->getTag($showTag) as $key => $tag) {
@@ -240,13 +242,13 @@ protected function describeContainerServices(ContainerBuilder $builder, array $o
240242
}
241243
}
242244
} else {
243-
$tableRows[] = array($serviceId, $definition->getClass());
245+
$tableRows[] = array($styledServiceId, $definition->getClass());
244246
}
245247
} elseif ($definition instanceof Alias) {
246248
$alias = $definition;
247-
$tableRows[] = array_merge(array($serviceId, sprintf('alias for "%s"', $alias)), $tagsCount ? array_fill(0, $tagsCount, '') : array());
249+
$tableRows[] = array_merge(array($styledServiceId, sprintf('alias for "%s"', $alias)), $tagsCount ? array_fill(0, $tagsCount, '') : array());
248250
} else {
249-
$tableRows[] = array_merge(array($serviceId, get_class($definition)), $tagsCount ? array_fill(0, $tagsCount, '') : array());
251+
$tableRows[] = array_merge(array($styledServiceId, get_class($definition)), $tagsCount ? array_fill(0, $tagsCount, '') : array());
250252
}
251253
}
252254

0 commit comments

Comments
 (0)