Updated the styles of the container commands
This commit is contained in:
parent
bee1faaa95
commit
d209a4ebac
@ -16,10 +16,10 @@ use Symfony\Component\Console\Input\InputArgument;
|
|||||||
use Symfony\Component\Console\Input\InputOption;
|
use Symfony\Component\Console\Input\InputOption;
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
|
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||||
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
|
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
|
||||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||||
use Symfony\Component\Config\FileLocator;
|
use Symfony\Component\Config\FileLocator;
|
||||||
use Symfony\Component\Console\Question\ChoiceQuestion;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A console command for retrieving information about services.
|
* A console command for retrieving information about services.
|
||||||
@ -94,8 +94,9 @@ EOF
|
|||||||
*/
|
*/
|
||||||
protected function execute(InputInterface $input, OutputInterface $output)
|
protected function execute(InputInterface $input, OutputInterface $output)
|
||||||
{
|
{
|
||||||
|
$output = new SymfonyStyle($input, $output);
|
||||||
if (false !== strpos($input->getFirstArgument(), ':d')) {
|
if (false !== strpos($input->getFirstArgument(), ':d')) {
|
||||||
$output->writeln('<comment>The use of "container:debug" command is deprecated since version 2.7 and will be removed in 3.0. Use the "debug:container" instead.</comment>');
|
$output->caution('The use of "container:debug" command is deprecated since version 2.7 and will be removed in 3.0. Use the "debug:container" instead.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->validateInput($input);
|
$this->validateInput($input);
|
||||||
@ -124,10 +125,11 @@ EOF
|
|||||||
$helper = new DescriptorHelper();
|
$helper = new DescriptorHelper();
|
||||||
$options['format'] = $input->getOption('format');
|
$options['format'] = $input->getOption('format');
|
||||||
$options['raw_text'] = $input->getOption('raw');
|
$options['raw_text'] = $input->getOption('raw');
|
||||||
|
$options['output'] = $output;
|
||||||
$helper->describe($output, $object, $options);
|
$helper->describe($output, $object, $options);
|
||||||
|
|
||||||
if (!$input->getArgument('name') && $input->isInteractive()) {
|
if (!$input->getArgument('name') && $input->isInteractive()) {
|
||||||
$output->writeln('To search for a service, re-run this command with a search term. <comment>debug:container log</comment>');
|
$output->comment('To search for a specific service, re-run this command with a search term. (e.g. <comment>debug:container log</comment>)');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -186,7 +188,7 @@ EOF
|
|||||||
return $this->containerBuilder = $container;
|
return $this->containerBuilder = $container;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function findProperServiceName(InputInterface $input, OutputInterface $output, ContainerBuilder $builder, $name)
|
private function findProperServiceName(InputInterface $input, SymfonyStyle $output, ContainerBuilder $builder, $name)
|
||||||
{
|
{
|
||||||
if ($builder->has($name) || !$input->isInteractive()) {
|
if ($builder->has($name) || !$input->isInteractive()) {
|
||||||
return $name;
|
return $name;
|
||||||
@ -197,10 +199,7 @@ EOF
|
|||||||
throw new \InvalidArgumentException(sprintf('No services found that match "%s".', $name));
|
throw new \InvalidArgumentException(sprintf('No services found that match "%s".', $name));
|
||||||
}
|
}
|
||||||
|
|
||||||
$question = new ChoiceQuestion('Choose a number for more information on the service', $matchingServices);
|
return $output->choice('Select one of the following services to display its information', $matchingServices);
|
||||||
$question->setErrorMessage('Service %s is invalid.');
|
|
||||||
|
|
||||||
return $this->getHelper('question')->ask($input, $output, $question);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function findServiceIdsContaining(ContainerBuilder $builder, $name)
|
private function findServiceIdsContaining(ContainerBuilder $builder, $name)
|
||||||
|
@ -105,16 +105,15 @@ class TextDescriptor extends Descriptor
|
|||||||
*/
|
*/
|
||||||
protected function describeContainerParameters(ParameterBag $parameters, array $options = array())
|
protected function describeContainerParameters(ParameterBag $parameters, array $options = array())
|
||||||
{
|
{
|
||||||
$table = new Table($this->getOutput());
|
$tableHeaders = array('Parameter', 'Value');
|
||||||
$table->setStyle('compact');
|
|
||||||
$table->setHeaders(array('Parameter', 'Value'));
|
|
||||||
|
|
||||||
|
$tableRows = array();
|
||||||
foreach ($this->sortParameters($parameters) as $parameter => $value) {
|
foreach ($this->sortParameters($parameters) as $parameter => $value) {
|
||||||
$table->addRow(array($parameter, $this->formatParameter($value)));
|
$tableRows[] = array($parameter, $this->formatParameter($value));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->writeText($this->formatSection('container', 'List of parameters')."\n", $options);
|
$options['output']->title('Symfony Container Parameters');
|
||||||
$table->render();
|
$options['output']->table($tableHeaders, $tableRows);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -123,15 +122,17 @@ class TextDescriptor extends Descriptor
|
|||||||
protected function describeContainerTags(ContainerBuilder $builder, array $options = array())
|
protected function describeContainerTags(ContainerBuilder $builder, array $options = array())
|
||||||
{
|
{
|
||||||
$showPrivate = isset($options['show_private']) && $options['show_private'];
|
$showPrivate = isset($options['show_private']) && $options['show_private'];
|
||||||
$description = array($this->formatSection('container', 'Tagged services'));
|
|
||||||
|
|
||||||
foreach ($this->findDefinitionsByTag($builder, $showPrivate) as $tag => $definitions) {
|
if ($showPrivate) {
|
||||||
$description[] = $this->formatSection('tag', $tag);
|
$options['output']->title('Symfony Container Public and Private Tags');
|
||||||
$description = array_merge($description, array_keys($definitions));
|
} else {
|
||||||
$description[] = '';
|
$options['output']->title('Symfony Container Public Tags');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->writeText(implode("\n", $description), $options);
|
foreach ($this->findDefinitionsByTag($builder, $showPrivate) as $tag => $definitions) {
|
||||||
|
$options['output']->section(sprintf('"%s" tag', $tag));
|
||||||
|
$options['output']->listing(array_keys($definitions));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -148,11 +149,13 @@ class TextDescriptor extends Descriptor
|
|||||||
} elseif ($service instanceof Definition) {
|
} elseif ($service instanceof Definition) {
|
||||||
$this->describeContainerDefinition($service, $options);
|
$this->describeContainerDefinition($service, $options);
|
||||||
} else {
|
} else {
|
||||||
$description = $this->formatSection('container', sprintf('Information for service <info>%s</info>', $options['id']))
|
$options['output']->title(sprintf('Information for Service "<info>%s</info>"', $options['id']));
|
||||||
."\n".sprintf('<comment>Service Id</comment> %s', isset($options['id']) ? $options['id'] : '-')
|
$options['output']->table(
|
||||||
."\n".sprintf('<comment>Class</comment> %s', get_class($service));
|
array('Service ID', 'Class'),
|
||||||
|
array(
|
||||||
$this->writeText($description, $options);
|
array(isset($options['id']) ? $options['id'] : '-', get_class($service)),
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -165,16 +168,16 @@ class TextDescriptor extends Descriptor
|
|||||||
$showTag = isset($options['tag']) ? $options['tag'] : null;
|
$showTag = isset($options['tag']) ? $options['tag'] : null;
|
||||||
|
|
||||||
if ($showPrivate) {
|
if ($showPrivate) {
|
||||||
$label = '<comment>Public</comment> and <comment>private</comment> services';
|
$title = 'Symfony Container Public and Private Services';
|
||||||
} else {
|
} else {
|
||||||
$label = '<comment>Public</comment> services';
|
$title = 'Symfony Container Public Services';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($showTag) {
|
if ($showTag) {
|
||||||
$label .= ' with tag <info>'.$options['tag'].'</info>';
|
$title .= sprintf(' Tagged with "%s" Tag', $options['tag']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->writeText($this->formatSection('container', $label)."\n", $options);
|
$options['output']->title($title);
|
||||||
|
|
||||||
$serviceIds = isset($options['tag']) && $options['tag'] ? array_keys($builder->findTaggedServiceIds($options['tag'])) : $builder->getServiceIds();
|
$serviceIds = isset($options['tag']) && $options['tag'] ? array_keys($builder->findTaggedServiceIds($options['tag'])) : $builder->getServiceIds();
|
||||||
$maxTags = array();
|
$maxTags = array();
|
||||||
@ -206,10 +209,8 @@ class TextDescriptor extends Descriptor
|
|||||||
$tagsCount = count($maxTags);
|
$tagsCount = count($maxTags);
|
||||||
$tagsNames = array_keys($maxTags);
|
$tagsNames = array_keys($maxTags);
|
||||||
|
|
||||||
$table = new Table($this->getOutput());
|
$tableHeaders = array_merge(array('Service ID'), $tagsNames, array('Class name'));
|
||||||
$table->setStyle('compact');
|
$tableRows = array();
|
||||||
$table->setHeaders(array_merge(array('Service ID'), $tagsNames, array('Class name')));
|
|
||||||
|
|
||||||
foreach ($this->sortServiceIds($serviceIds) as $serviceId) {
|
foreach ($this->sortServiceIds($serviceIds) as $serviceId) {
|
||||||
$definition = $this->resolveServiceDefinition($builder, $serviceId);
|
$definition = $this->resolveServiceDefinition($builder, $serviceId);
|
||||||
if ($definition instanceof Definition) {
|
if ($definition instanceof Definition) {
|
||||||
@ -220,24 +221,24 @@ class TextDescriptor extends Descriptor
|
|||||||
$tagValues[] = isset($tag[$tagName]) ? $tag[$tagName] : '';
|
$tagValues[] = isset($tag[$tagName]) ? $tag[$tagName] : '';
|
||||||
}
|
}
|
||||||
if (0 === $key) {
|
if (0 === $key) {
|
||||||
$table->addRow(array_merge(array($serviceId), $tagValues, array($definition->getClass())));
|
$tableRows[] = array_merge(array($serviceId), $tagValues, array($definition->getClass()));
|
||||||
} else {
|
} else {
|
||||||
$table->addRow(array_merge(array(' "'), $tagValues, array('')));
|
$tableRows[] = array_merge(array(' "'), $tagValues, array(''));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$table->addRow(array($serviceId, $definition->getClass()));
|
$tableRows[] = array($serviceId, $definition->getClass());
|
||||||
}
|
}
|
||||||
} elseif ($definition instanceof Alias) {
|
} elseif ($definition instanceof Alias) {
|
||||||
$alias = $definition;
|
$alias = $definition;
|
||||||
$table->addRow(array_merge(array($serviceId, sprintf('alias for "%s"', $alias)), $tagsCount ? array_fill(0, $tagsCount, '') : array()));
|
$tableRows[] = array_merge(array($serviceId, sprintf('alias for "%s"', $alias)), $tagsCount ? array_fill(0, $tagsCount, '') : array());
|
||||||
} else {
|
} else {
|
||||||
// we have no information (happens with "service_container")
|
// we have no information (happens with "service_container")
|
||||||
$table->addRow(array_merge(array($serviceId, get_class($definition)), $tagsCount ? array_fill(0, $tagsCount, '') : array()));
|
$tableRows[] = array_merge(array($serviceId, get_class($definition)), $tagsCount ? array_fill(0, $tagsCount, '') : array());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$table->render();
|
$options['output']->table($tableHeaders, $tableRows);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -245,71 +246,79 @@ class TextDescriptor extends Descriptor
|
|||||||
*/
|
*/
|
||||||
protected function describeContainerDefinition(Definition $definition, array $options = array())
|
protected function describeContainerDefinition(Definition $definition, array $options = array())
|
||||||
{
|
{
|
||||||
$description = isset($options['id'])
|
if (isset($options['id'])) {
|
||||||
? array($this->formatSection('container', sprintf('Information for service <info>%s</info>', $options['id'])))
|
$options['output']->title(sprintf('Information for Service "<info>%s</info>"', $options['id']));
|
||||||
: array();
|
}
|
||||||
|
|
||||||
$description[] = sprintf('<comment>Service Id</comment> %s', isset($options['id']) ? $options['id'] : '-');
|
$tableHeaders = array('Option', 'Value');
|
||||||
$description[] = sprintf('<comment>Class</comment> %s', $definition->getClass() ?: '-');
|
|
||||||
|
$tableRows[] = array('Service ID', isset($options['id']) ? $options['id'] : '-');
|
||||||
|
$tableRows[] = array('Class', $definition->getClass() ?: '-');
|
||||||
|
|
||||||
$tags = $definition->getTags();
|
$tags = $definition->getTags();
|
||||||
if (count($tags)) {
|
if (count($tags)) {
|
||||||
$description[] = '<comment>Tags</comment>';
|
$tagInformation = '';
|
||||||
foreach ($tags as $tagName => $tagData) {
|
foreach ($tags as $tagName => $tagData) {
|
||||||
foreach ($tagData as $parameters) {
|
foreach ($tagData as $tagParameters) {
|
||||||
$description[] = sprintf(' - %-30s (%s)', $tagName, implode(', ', array_map(function ($key, $value) {
|
$parameters = array_map(function ($key, $value) {
|
||||||
return sprintf('<info>%s</info>: %s', $key, $value);
|
return sprintf('<info>%s</info>: %s', $key, $value);
|
||||||
}, array_keys($parameters), array_values($parameters))));
|
}, array_keys($tagParameters), array_values($tagParameters));
|
||||||
|
$parameters = implode(', ', $parameters);
|
||||||
|
|
||||||
|
if ('' === $parameters) {
|
||||||
|
$tagInformation .= sprintf('%s', $tagName);
|
||||||
|
} else {
|
||||||
|
$tagInformation .= sprintf('%s (%s)', $tagName, $parameters);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$description[] = '<comment>Tags</comment> -';
|
$tagInformation = '-';
|
||||||
}
|
}
|
||||||
|
$tableRows[] = array('Tags', $tagInformation);
|
||||||
|
|
||||||
|
$tableRows[] = array('Scope', $definition->getScope(false));
|
||||||
|
$tableRows[] = array('Public', $definition->isPublic() ? 'yes' : 'no');
|
||||||
|
$tableRows[] = array('Synthetic', $definition->isSynthetic() ? 'yes' : 'no');
|
||||||
|
$tableRows[] = array('Lazy', $definition->isLazy() ? 'yes' : 'no');
|
||||||
|
|
||||||
$description[] = sprintf('<comment>Scope</comment> %s', $definition->getScope(false));
|
|
||||||
$description[] = sprintf('<comment>Public</comment> %s', $definition->isPublic() ? 'yes' : 'no');
|
|
||||||
$description[] = sprintf('<comment>Synthetic</comment> %s', $definition->isSynthetic() ? 'yes' : 'no');
|
|
||||||
$description[] = sprintf('<comment>Lazy</comment> %s', $definition->isLazy() ? 'yes' : 'no');
|
|
||||||
if (method_exists($definition, 'isShared')) {
|
|
||||||
$description[] = sprintf('<comment>Shared</comment> %s', $definition->isShared() ? 'yes' : 'no');
|
|
||||||
}
|
|
||||||
if (method_exists($definition, 'isSynchronized')) {
|
if (method_exists($definition, 'isSynchronized')) {
|
||||||
$description[] = sprintf('<comment>Synchronized</comment> %s', $definition->isSynchronized(false) ? 'yes' : 'no');
|
$tableRows[] = array('Synchronized', $definition->isSynchronized(false) ? 'yes' : 'no');
|
||||||
}
|
}
|
||||||
$description[] = sprintf('<comment>Abstract</comment> %s', $definition->isAbstract() ? 'yes' : 'no');
|
$tableRows[] = array('Abstract', $definition->isAbstract() ? 'yes' : 'no');
|
||||||
|
|
||||||
if ($definition->getFile()) {
|
if ($definition->getFile()) {
|
||||||
$description[] = sprintf('<comment>Required File</comment> %s', $definition->getFile() ?: '-');
|
$tableRows[] = array('Required File', $definition->getFile() ? $definition->getFile() : '-');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($definition->getFactoryClass(false)) {
|
if ($definition->getFactoryClass(false)) {
|
||||||
$description[] = sprintf('<comment>Factory Class</comment> %s', $definition->getFactoryClass(false));
|
$tableRows[] = array('Factory Class', $definition->getFactoryClass(false));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($definition->getFactoryService(false)) {
|
if ($definition->getFactoryService(false)) {
|
||||||
$description[] = sprintf('<comment>Factory Service</comment> %s', $definition->getFactoryService(false));
|
$tableRows[] = array('Factory Service', $definition->getFactoryService(false));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($definition->getFactoryMethod(false)) {
|
if ($definition->getFactoryMethod(false)) {
|
||||||
$description[] = sprintf('<comment>Factory Method</comment> %s', $definition->getFactoryMethod(false));
|
$tableRows[] = array('Factory Method', $definition->getFactoryMethod(false));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($factory = $definition->getFactory()) {
|
if ($factory = $definition->getFactory()) {
|
||||||
if (is_array($factory)) {
|
if (is_array($factory)) {
|
||||||
if ($factory[0] instanceof Reference) {
|
if ($factory[0] instanceof Reference) {
|
||||||
$description[] = sprintf('<comment>Factory Service</comment> %s', $factory[0]);
|
$tableRows[] = array('Factory Service', $factory[0]);
|
||||||
} elseif ($factory[0] instanceof Definition) {
|
} elseif ($factory[0] instanceof Definition) {
|
||||||
throw new \InvalidArgumentException('Factory is not describable.');
|
throw new \InvalidArgumentException('Factory is not describable.');
|
||||||
} else {
|
} else {
|
||||||
$description[] = sprintf('<comment>Factory Class</comment> %s', $factory[0]);
|
$tableRows[] = array('Factory Class', $factory[0]);
|
||||||
}
|
}
|
||||||
$description[] = sprintf('<comment>Factory Method</comment> %s', $factory[1]);
|
$tableRows[] = array('Factory Method', $factory[1]);
|
||||||
} else {
|
} else {
|
||||||
$description[] = sprintf('<comment>Factory Function</comment> %s', $factory);
|
$tableRows[] = array('Factory Function', $factory);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->writeText(implode("\n", $description)."\n", $options);
|
$options['output']->table($tableHeaders, $tableRows);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -317,7 +326,7 @@ class TextDescriptor extends Descriptor
|
|||||||
*/
|
*/
|
||||||
protected function describeContainerAlias(Alias $alias, array $options = array())
|
protected function describeContainerAlias(Alias $alias, array $options = array())
|
||||||
{
|
{
|
||||||
$this->writeText(sprintf("This service is an alias for the service <info>%s</info>\n", (string) $alias), $options);
|
$options['output']->comment(sprintf("This service is an alias for the service <info>%s</info>\n", (string) $alias));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -325,7 +334,12 @@ class TextDescriptor extends Descriptor
|
|||||||
*/
|
*/
|
||||||
protected function describeContainerParameter($parameter, array $options = array())
|
protected function describeContainerParameter($parameter, array $options = array())
|
||||||
{
|
{
|
||||||
$this->writeText($this->formatParameter($parameter), $options);
|
$options['output']->table(
|
||||||
|
array('Parameter', 'Value'),
|
||||||
|
array(
|
||||||
|
array($options['parameter'], $this->formatParameter($parameter),
|
||||||
|
),
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -344,16 +358,33 @@ class TextDescriptor extends Descriptor
|
|||||||
|
|
||||||
$this->writeText($this->formatSection('event_dispatcher', $label)."\n", $options);
|
$this->writeText($this->formatSection('event_dispatcher', $label)."\n", $options);
|
||||||
|
|
||||||
$registeredListeners = $eventDispatcher->getListeners($event, true);
|
$registeredListeners = $eventDispatcher->getListeners($event);
|
||||||
|
|
||||||
if (null !== $event) {
|
if (null !== $event) {
|
||||||
$this->writeText("\n");
|
$this->writeText("\n");
|
||||||
$this->renderEventListenerTable($registeredListeners);
|
$table = new Table($this->getOutput());
|
||||||
|
$table->getStyle()->setCellHeaderFormat('%s');
|
||||||
|
$table->setHeaders(array('Order', 'Callable'));
|
||||||
|
|
||||||
|
foreach ($registeredListeners as $order => $listener) {
|
||||||
|
$table->addRow(array(sprintf('#%d', $order + 1), $this->formatCallable($listener)));
|
||||||
|
}
|
||||||
|
|
||||||
|
$table->render();
|
||||||
} else {
|
} else {
|
||||||
ksort($registeredListeners);
|
ksort($registeredListeners);
|
||||||
foreach ($registeredListeners as $eventListened => $eventListeners) {
|
foreach ($registeredListeners as $eventListened => $eventListeners) {
|
||||||
$this->writeText(sprintf("\n<info>[Event]</info> %s\n", $eventListened), $options);
|
$this->writeText(sprintf("\n<info>[Event]</info> %s\n", $eventListened), $options);
|
||||||
$this->renderEventListenerTable($eventListeners);
|
|
||||||
|
$table = new Table($this->getOutput());
|
||||||
|
$table->getStyle()->setCellHeaderFormat('%s');
|
||||||
|
$table->setHeaders(array('Order', 'Callable'));
|
||||||
|
|
||||||
|
foreach ($eventListeners as $order => $eventListener) {
|
||||||
|
$table->addRow(array(sprintf('#%d', $order + 1), $this->formatCallable($eventListener)));
|
||||||
|
}
|
||||||
|
|
||||||
|
$table->render();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,9 @@
|
|||||||
|
|
||||||
namespace Symfony\Bundle\FrameworkBundle\Tests\Console\Descriptor;
|
namespace Symfony\Bundle\FrameworkBundle\Tests\Console\Descriptor;
|
||||||
|
|
||||||
|
use Symfony\Component\Console\Input\ArrayInput;
|
||||||
use Symfony\Component\Console\Output\BufferedOutput;
|
use Symfony\Component\Console\Output\BufferedOutput;
|
||||||
|
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||||
use Symfony\Component\DependencyInjection\Alias;
|
use Symfony\Component\DependencyInjection\Alias;
|
||||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||||
use Symfony\Component\DependencyInjection\Definition;
|
use Symfony\Component\DependencyInjection\Definition;
|
||||||
@ -149,6 +151,11 @@ abstract class AbstractDescriptorTest extends \PHPUnit_Framework_TestCase
|
|||||||
{
|
{
|
||||||
$options['raw_output'] = true;
|
$options['raw_output'] = true;
|
||||||
$output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, true);
|
$output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, true);
|
||||||
|
|
||||||
|
if ('txt' === $this->getFormat()) {
|
||||||
|
$options['output'] = new SymfonyStyle(new ArrayInput(array()), $output);
|
||||||
|
}
|
||||||
|
|
||||||
$this->getDescriptor()->describe($output, $describedObject, $options);
|
$this->getDescriptor()->describe($output, $describedObject, $options);
|
||||||
|
|
||||||
if ('json' === $this->getFormat()) {
|
if ('json' === $this->getFormat()) {
|
||||||
|
@ -1 +1 @@
|
|||||||
This service is an alias for the service <info>service_1</info>
|
// This service is an alias for the service [32mservice_1[39m
|
@ -1 +1 @@
|
|||||||
This service is an alias for the service <info>service_2</info>
|
// This service is an alias for the service [32mservice_2[39m
|
@ -1,6 +1,11 @@
|
|||||||
<info>[container]</info> <comment>Public</comment> services
|
[33mSymfony Container Public Services[39m
|
||||||
[32mService ID [39m [32mClass name [39m
|
[33m=================================[39m
|
||||||
alias_1 alias for "service_1"
|
|
||||||
alias_2 alias for "service_2"
|
------------------- --------------------------------------------------------
|
||||||
definition_1 Full\Qualified\Class1
|
[32mService ID[39m [32mClass name[39m
|
||||||
service_container Symfony\Component\DependencyInjection\ContainerBuilder
|
------------------- --------------------------------------------------------
|
||||||
|
alias_1 alias for "service_1"
|
||||||
|
alias_2 alias for "service_2"
|
||||||
|
definition_1 Full\Qualified\Class1
|
||||||
|
service_container Symfony\Component\DependencyInjection\ContainerBuilder
|
||||||
|
------------------- --------------------------------------------------------
|
@ -1,7 +1,12 @@
|
|||||||
<info>[container]</info> <comment>Public</comment> and <comment>private</comment> services
|
[33mSymfony Container Public and Private Services[39m
|
||||||
[32mService ID [39m [32mClass name [39m
|
[33m=============================================[39m
|
||||||
alias_1 alias for "service_1"
|
|
||||||
alias_2 alias for "service_2"
|
------------------- --------------------------------------------------------
|
||||||
definition_1 Full\Qualified\Class1
|
[32mService ID[39m [32mClass name[39m
|
||||||
definition_2 Full\Qualified\Class2
|
------------------- --------------------------------------------------------
|
||||||
service_container Symfony\Component\DependencyInjection\ContainerBuilder
|
alias_1 alias for "service_1"
|
||||||
|
alias_2 alias for "service_2"
|
||||||
|
definition_1 Full\Qualified\Class1
|
||||||
|
definition_2 Full\Qualified\Class2
|
||||||
|
service_container Symfony\Component\DependencyInjection\ContainerBuilder
|
||||||
|
------------------- --------------------------------------------------------
|
@ -1,4 +1,9 @@
|
|||||||
<info>[container]</info> <comment>Public</comment> and <comment>private</comment> services with tag <info>tag1</info>
|
[33mSymfony Container Public and Private Services Tagged with "tag1" Tag[39m
|
||||||
[32mService ID [39m [32mattr1[39m [32mattr2[39m [32mattr3[39m [32mClass name [39m
|
[33m====================================================================[39m
|
||||||
definition_2 val1 val2 Full\Qualified\Class2
|
|
||||||
" val3
|
-------------- ------- ------- ------- -----------------------
|
||||||
|
[32mService ID[39m [32mattr1[39m [32mattr2[39m [32mattr3[39m [32mClass name[39m
|
||||||
|
-------------- ------- ------- ------- -----------------------
|
||||||
|
definition_2 val1 val2 Full\Qualified\Class2
|
||||||
|
" val3
|
||||||
|
-------------- ------- ------- ------- -----------------------
|
@ -1,6 +1,12 @@
|
|||||||
<info>[container]</info> Tagged services
|
[33mSymfony Container Public and Private Tags[39m
|
||||||
<info>[tag]</info> tag1
|
[33m=========================================[39m
|
||||||
definition_2
|
|
||||||
|
|
||||||
<info>[tag]</info> tag2
|
[33m"tag1" tag[39m
|
||||||
definition_2
|
[33m----------[39m
|
||||||
|
|
||||||
|
* definition_2
|
||||||
|
|
||||||
|
[33m"tag2" tag[39m
|
||||||
|
[33m----------[39m
|
||||||
|
|
||||||
|
* definition_2
|
@ -1,12 +1,15 @@
|
|||||||
<comment>Service Id</comment> -
|
---------------- -----------------------------
|
||||||
<comment>Class</comment> Full\Qualified\Class1
|
[32mOption[39m [32mValue[39m
|
||||||
<comment>Tags</comment> -
|
---------------- -----------------------------
|
||||||
<comment>Scope</comment> container
|
Service ID -
|
||||||
<comment>Public</comment> yes
|
Class Full\Qualified\Class1
|
||||||
<comment>Synthetic</comment> no
|
Tags -
|
||||||
<comment>Lazy</comment> yes
|
Scope container
|
||||||
<comment>Shared</comment> yes
|
Public yes
|
||||||
<comment>Synchronized</comment> no
|
Synthetic no
|
||||||
<comment>Abstract</comment> yes
|
Lazy yes
|
||||||
<comment>Factory Class</comment> Full\Qualified\FactoryClass
|
Synchronized no
|
||||||
<comment>Factory Method</comment> get
|
Abstract yes
|
||||||
|
Factory Class Full\Qualified\FactoryClass
|
||||||
|
Factory Method get
|
||||||
|
---------------- -----------------------------
|
@ -1,16 +1,16 @@
|
|||||||
<comment>Service Id</comment> -
|
----------------- -------------------------------------------------------
|
||||||
<comment>Class</comment> Full\Qualified\Class2
|
[32mOption[39m [32mValue[39m
|
||||||
<comment>Tags</comment>
|
----------------- -------------------------------------------------------
|
||||||
- tag1 (<info>attr1</info>: val1, <info>attr2</info>: val2)
|
Service ID -
|
||||||
- tag1 (<info>attr3</info>: val3)
|
Class Full\Qualified\Class2
|
||||||
- tag2 ()
|
Tags tag1 ([32mattr1[39m: val1, [32mattr2[39m: val2)tag1 ([32mattr3[39m: val3)tag2
|
||||||
<comment>Scope</comment> container
|
Scope container
|
||||||
<comment>Public</comment> no
|
Public no
|
||||||
<comment>Synthetic</comment> yes
|
Synthetic yes
|
||||||
<comment>Lazy</comment> no
|
Lazy no
|
||||||
<comment>Shared</comment> yes
|
Synchronized no
|
||||||
<comment>Synchronized</comment> no
|
Abstract no
|
||||||
<comment>Abstract</comment> no
|
Required File /path/to/file
|
||||||
<comment>Required File</comment> /path/to/file
|
Factory Service factory.service
|
||||||
<comment>Factory Service</comment> factory.service
|
Factory Method get
|
||||||
<comment>Factory Method</comment> get
|
----------------- -------------------------------------------------------
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
<info>[event_dispatcher]</info> Registered listeners for event <info>event1</info>
|
<info>[event_dispatcher]</info> Registered listeners for event <info>event1</info>
|
||||||
|
|
||||||
+-------+-------------------+----------+
|
+-------+-------------------+
|
||||||
| Order | Callable | Priority |
|
| Order | Callable |
|
||||||
+-------+-------------------+----------+
|
+-------+-------------------+
|
||||||
| #1 | global_function() | 255 |
|
| #1 | global_function() |
|
||||||
| #2 | \Closure() | -1 |
|
| #2 | \Closure() |
|
||||||
+-------+-------------------+----------+
|
+-------+-------------------+
|
@ -1,16 +1,16 @@
|
|||||||
<info>[event_dispatcher]</info> Registered listeners by event
|
<info>[event_dispatcher]</info> Registered listeners by event
|
||||||
|
|
||||||
<info>[Event]</info> event1
|
<info>[Event]</info> event1
|
||||||
+-------+-------------------+----------+
|
+-------+-------------------+
|
||||||
| Order | Callable | Priority |
|
| Order | Callable |
|
||||||
+-------+-------------------+----------+
|
+-------+-------------------+
|
||||||
| #1 | global_function() | 255 |
|
| #1 | global_function() |
|
||||||
| #2 | \Closure() | -1 |
|
| #2 | \Closure() |
|
||||||
+-------+-------------------+----------+
|
+-------+-------------------+
|
||||||
|
|
||||||
<info>[Event]</info> event2
|
<info>[Event]</info> event2
|
||||||
+-------+-----------------------------------------------------------------------------------+----------+
|
+-------+-----------------------------------------------------------------------------------+
|
||||||
| Order | Callable | Priority |
|
| Order | Callable |
|
||||||
+-------+-----------------------------------------------------------------------------------+----------+
|
+-------+-----------------------------------------------------------------------------------+
|
||||||
| #1 | Symfony\Bundle\FrameworkBundle\Tests\Console\Descriptor\CallableClass::__invoke() | 0 |
|
| #1 | Symfony\Bundle\FrameworkBundle\Tests\Console\Descriptor\CallableClass::__invoke() |
|
||||||
+-------+-----------------------------------------------------------------------------------+----------+
|
+-------+-----------------------------------------------------------------------------------+
|
@ -1,12 +1,15 @@
|
|||||||
<comment>Service Id</comment> -
|
---------------- -----------------------------
|
||||||
<comment>Class</comment> Full\Qualified\Class1
|
[32mOption[39m [32mValue[39m
|
||||||
<comment>Tags</comment> -
|
---------------- -----------------------------
|
||||||
<comment>Scope</comment> container
|
Service ID -
|
||||||
<comment>Public</comment> yes
|
Class Full\Qualified\Class1
|
||||||
<comment>Synthetic</comment> no
|
Tags -
|
||||||
<comment>Lazy</comment> yes
|
Scope container
|
||||||
<comment>Shared</comment> yes
|
Public yes
|
||||||
<comment>Synchronized</comment> yes
|
Synthetic no
|
||||||
<comment>Abstract</comment> yes
|
Lazy yes
|
||||||
<comment>Factory Class</comment> Full\Qualified\FactoryClass
|
Synchronized yes
|
||||||
<comment>Factory Method</comment> get
|
Abstract yes
|
||||||
|
Factory Class Full\Qualified\FactoryClass
|
||||||
|
Factory Method get
|
||||||
|
---------------- -----------------------------
|
@ -1,16 +1,16 @@
|
|||||||
<comment>Service Id</comment> -
|
----------------- -------------------------------------------------------
|
||||||
<comment>Class</comment> Full\Qualified\Class2
|
[32mOption[39m [32mValue[39m
|
||||||
<comment>Tags</comment>
|
----------------- -------------------------------------------------------
|
||||||
- tag1 (<info>attr1</info>: val1, <info>attr2</info>: val2)
|
Service ID -
|
||||||
- tag1 (<info>attr3</info>: val3)
|
Class Full\Qualified\Class2
|
||||||
- tag2 ()
|
Tags tag1 ([32mattr1[39m: val1, [32mattr2[39m: val2)tag1 ([32mattr3[39m: val3)tag2
|
||||||
<comment>Scope</comment> container
|
Scope container
|
||||||
<comment>Public</comment> no
|
Public no
|
||||||
<comment>Synthetic</comment> yes
|
Synthetic yes
|
||||||
<comment>Lazy</comment> no
|
Lazy no
|
||||||
<comment>Shared</comment> yes
|
Synchronized no
|
||||||
<comment>Synchronized</comment> no
|
Abstract no
|
||||||
<comment>Abstract</comment> no
|
Required File /path/to/file
|
||||||
<comment>Required File</comment> /path/to/file
|
Factory Service factory.service
|
||||||
<comment>Factory Service</comment> factory.service
|
Factory Method get
|
||||||
<comment>Factory Method</comment> get
|
----------------- -------------------------------------------------------
|
@ -1 +1,5 @@
|
|||||||
symfony
|
--------------- ---------
|
||||||
|
[32mParameter[39m [32mValue[39m
|
||||||
|
--------------- ---------
|
||||||
|
database_name symfony
|
||||||
|
--------------- ---------
|
@ -1,6 +1,11 @@
|
|||||||
<info>[container]</info> List of parameters
|
[33mSymfony Container Parameters[39m
|
||||||
[32mParameter[39m [32mValue [39m
|
[33m============================[39m
|
||||||
array [12,"Hello world!",true]
|
|
||||||
boolean true
|
----------- --------------------------
|
||||||
integer 12
|
[32mParameter[39m [32mValue[39m
|
||||||
string Hello world!
|
----------- --------------------------
|
||||||
|
array [12,"Hello world!",true]
|
||||||
|
boolean true
|
||||||
|
integer 12
|
||||||
|
string Hello world!
|
||||||
|
----------- --------------------------
|
@ -1,6 +1,6 @@
|
|||||||
+---------+----------+------------+-----------+---------------+
|
--------- ---------- ------------ ----------- ---------------
|
||||||
|[32m Name [39m|[32m Method [39m|[32m Scheme [39m|[32m Host [39m|[32m Path [39m|
|
[32mName[39m [32mMethod[39m [32mScheme[39m [32mHost[39m [32mPath[39m
|
||||||
+---------+----------+------------+-----------+---------------+
|
--------- ---------- ------------ ----------- ---------------
|
||||||
| route_1 | GET|HEAD | http|https | localhost | /hello/{name} |
|
route_1 GET|HEAD http|https localhost /hello/{name}
|
||||||
| route_2 | PUT|POST | http|https | localhost | /name/add |
|
route_2 PUT|POST http|https localhost /name/add
|
||||||
+---------+----------+------------+-----------+---------------+
|
--------- ---------- ------------ ----------- ---------------
|
Reference in New Issue
Block a user