None of the routes match the path "%s">', $input->getArgument('path_info')));
+ $output->error(sprintf('None of the routes match the path "%s"', $input->getArgument('path_info')));
return 1;
}
diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php
index 56ffa455faca..03158d3d0d17 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php
@@ -34,11 +34,13 @@ class TextDescriptor extends Descriptor
protected function describeRouteCollection(RouteCollection $routes, array $options = array())
{
$showControllers = isset($options['show_controllers']) && $options['show_controllers'];
- $headers = array('Name', 'Method', 'Scheme', 'Host', 'Path');
- $table = new Table($this->getOutput());
- $table->setStyle('compact');
- $table->setHeaders($showControllers ? array_merge($headers, array('Controller')) : $headers);
+ $tableHeaders = array('Name', 'Method', 'Scheme', 'Host', 'Path');
+ if ($showControllers) {
+ $tableHeaders[] = 'Controller';
+ }
+
+ $tableRows = array();
foreach ($routes->all() as $name => $route) {
$row = array(
$name,
@@ -58,11 +60,16 @@ protected function describeRouteCollection(RouteCollection $routes, array $optio
$row[] = $controller;
}
- $table->addRow($row);
+ $tableRows[] = $row;
}
- $this->writeText($this->formatSection('router', 'Current routes')."\n", $options);
- $table->render();
+ if (isset($options['output'])) {
+ $options['output']->table($tableHeaders, $tableRows);
+ } else {
+ $table = new Table($this->getOutput());
+ $table->setHeaders($tableHeaders)->setRows($tableRows);
+ $table->render();
+ }
}
/**
@@ -73,26 +80,24 @@ protected function describeRoute(Route $route, array $options = array())
$requirements = $route->getRequirements();
unset($requirements['_scheme'], $requirements['_method']);
- // fixme: values were originally written as raw
- $description = array(
- 'Path '.$route->getPath(),
- 'Path Regex '.$route->compile()->getRegex(),
- 'Host '.('' !== $route->getHost() ? $route->getHost() : 'ANY'),
- 'Host Regex '.('' !== $route->getHost() ? $route->compile()->getHostRegex() : ''),
- 'Scheme '.($route->getSchemes() ? implode('|', $route->getSchemes()) : 'ANY'),
- 'Method '.($route->getMethods() ? implode('|', $route->getMethods()) : 'ANY'),
- 'Class '.get_class($route),
- 'Defaults '.$this->formatRouterConfig($route->getDefaults()),
- 'Requirements '.($requirements ? $this->formatRouterConfig($requirements) : 'NO CUSTOM'),
- 'Options '.$this->formatRouterConfig($route->getOptions()),
+ $tableHeaders = array('Property', 'Value');
+ $tableRows = array(
+ array('Route Name', $options['name']),
+ array('Path', $route->getPath()),
+ array('Path Regex', $route->compile()->getRegex()),
+ array('Host', ('' !== $route->getHost() ? $route->getHost() : 'ANY')),
+ array('Host Regex', ('' !== $route->getHost() ? $route->compile()->getHostRegex() : '')),
+ array('Scheme', ($route->getSchemes() ? implode('|', $route->getSchemes()) : 'ANY')),
+ array('Method', ($route->getMethods() ? implode('|', $route->getMethods()) : 'ANY')),
+ array('Requirements', ($requirements ? $this->formatRouterConfig($requirements) : 'NO CUSTOM')),
+ array('Class', get_class($route)),
+ array('Defaults', $this->formatRouterConfig($route->getDefaults())),
+ array('Options', $this->formatRouterConfig($route->getOptions())),
);
- if (isset($options['name'])) {
- array_unshift($description, 'Name '.$options['name']);
- array_unshift($description, $this->formatSection('router', sprintf('Route "%s"', $options['name'])));
- }
-
- $this->writeText(implode("\n", $description)."\n", $options);
+ $table = new Table($this->getOutput());
+ $table->setHeaders($tableHeaders)->setRows($tableRows);
+ $table->render();
}
/**
@@ -174,7 +179,7 @@ protected function describeContainerServices(ContainerBuilder $builder, array $o
$serviceIds = isset($options['tag']) && $options['tag'] ? array_keys($builder->findTaggedServiceIds($options['tag'])) : $builder->getServiceIds();
$maxTags = array();
- foreach ($serviceIds as $key => $serviceId) {
+ foreach ($serviceIds as $key => $serviceId) {
$definition = $this->resolveServiceDefinition($builder, $serviceId);
if ($definition instanceof Definition) {
// filter out private services unless shown explicitly
@@ -212,7 +217,7 @@ protected function describeContainerServices(ContainerBuilder $builder, array $o
foreach ($definition->getTag($showTag) as $key => $tag) {
$tagValues = array();
foreach ($tagsNames as $tagName) {
- $tagValues[] = isset($tag[$tagName]) ? $tag[$tagName] : "";
+ $tagValues[] = isset($tag[$tagName]) ? $tag[$tagName] : '';
}
if (0 === $key) {
$table->addRow(array_merge(array($serviceId), $tagValues, array($definition->getClass())));
@@ -225,10 +230,10 @@ protected function describeContainerServices(ContainerBuilder $builder, array $o
}
} elseif ($definition instanceof Alias) {
$alias = $definition;
- $table->addRow(array_merge(array($serviceId, sprintf('alias for "%s"', $alias)), $tagsCount ? array_fill(0, $tagsCount, "") : array()));
+ $table->addRow(array_merge(array($serviceId, sprintf('alias for "%s"', $alias)), $tagsCount ? array_fill(0, $tagsCount, '') : array()));
} else {
// we have no information (happens with "service_container")
- $table->addRow(array_merge(array($serviceId, get_class($definition)), $tagsCount ? array_fill(0, $tagsCount, "") : array()));
+ $table->addRow(array_merge(array($serviceId, get_class($definition)), $tagsCount ? array_fill(0, $tagsCount, '') : array()));
}
}
@@ -245,7 +250,7 @@ protected function describeContainerDefinition(Definition $definition, array $op
: array();
$description[] = sprintf('Service Id %s', isset($options['id']) ? $options['id'] : '-');
- $description[] = sprintf('Class %s', $definition->getClass() ?: "-");
+ $description[] = sprintf('Class %s', $definition->getClass() ?: '-');
$tags = $definition->getTags();
if (count($tags)) {
@@ -376,23 +381,24 @@ protected function describeCallable($callable, array $options = array())
}
/**
- * @param array $array
+ * @param array $config
*
* @return string
*/
- private function formatRouterConfig(array $array)
+ private function formatRouterConfig(array $config)
{
- if (!count($array)) {
+ if (empty($config)) {
return 'NONE';
}
- $string = '';
- ksort($array);
- foreach ($array as $name => $value) {
- $string .= ($string ? "\n".str_repeat(' ', 13) : '').$name.': '.$this->formatValue($value);
+ ksort($config);
+
+ $configAsString = '';
+ foreach ($config as $key => $value) {
+ $configAsString .= sprintf("\n%s: %s", $key, $this->formatValue($value));
}
- return $string;
+ return trim($configAsString);
}
/**
pFad - Phonifier reborn
Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies:
Alternative Proxy
pFad Proxy
pFad v3 Proxy
pFad v4 Proxy