8000 Making the service id jump out with debug:container or debug:types · symfony/symfony@a827e29 · GitHub
[go: up one dir, main page]

Skip to content

Commit a827e29

Browse files
committed
Making the service id jump out with debug:container or debug:types
1 parent 7242c86 commit a827e29

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

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

Lines changed: 5 additions & 3 deletions
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_text']) && $options['raw_text'];
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

src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/AbstractDescriptorTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ abstract protected function getFormat();
183183
private function assertDescription($expectedDescription, $describedObject, array $options = array())
184184
{
185185
$options['raw_output'] = true;
186+
$options['raw_text'] = true;
186187
$output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, true);
187188

188189
if ('txt' === $this->getFormat()) {

0 commit comments

Comments
 (0)
0