Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Console] Removed DialogHelper, ProgressHelper and TableHelper #13121

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 30, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
namespace Symfony\Bundle\FrameworkBundle\Console\Descriptor;

use Symfony\Component\Console\Descriptor\DescriptorInterface;
use Symfony\Component\Console\Helper\TableHelper;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\DependencyInjection\Alias;
use Symfony\Component\DependencyInjection\ContainerBuilder;
Expand All @@ -30,7 +29,7 @@ abstract class Descriptor implements DescriptorInterface
/**
* @var OutputInterface
*/
private $output;
protected $output;

/**
* {@inheritdoc}
Expand Down Expand Up @@ -89,22 +88,6 @@ protected function write($content, $decorated = false)
$this->output->write($content, false, $decorated ? OutputInterface::OUTPUT_NORMAL : OutputInterface::OUTPUT_RAW);
}

/**
* Writes content to output.
*
* @param TableHelper $table
* @param bool $decorated
*/
protected function renderTable(TableHelper $table, $decorated = false)
{
if (!$decorated) {
$table->setCellRowFormat('%s');
$table->setCellHeaderFormat('%s');
}

$table->render($this->output);
}

/**
* Describes an InputArgument instance.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace Symfony\Bundle\FrameworkBundle\Console\Descriptor;

use Symfony\Component\Console\Helper\TableHelper;
use Symfony\Component\Console\Helper\Table;
use Symfony\Component\DependencyInjection\Alias;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
Expand All @@ -30,10 +30,10 @@ class TextDescriptor extends Descriptor
*/
protected function describeRouteCollection(RouteCollection $routes, array $options = array())
{
$table = new Table($this->output);

$showControllers = isset($options['show_controllers']) && $options['show_controllers'];
$headers = array('Name', 'Method', 'Scheme', 'Host', 'Path');
$table = new TableHelper();
$table->setLayout(TableHelper::LAYOUT_COMPACT);
$table->setHeaders($showControllers ? array_merge($headers, array('Controller')) : $headers);

foreach ($routes->all() as $name => $route) {
Expand All @@ -59,7 +59,7 @@ protected function describeRouteCollection(RouteCollection $routes, array $optio
}

$this->writeText($this->formatSection('router', 'Current routes')."\n", $options);
$this->renderTable($table, !(isset($options['raw_output']) && $options['raw_output']));
$table->render();
}

/**
Expand Down Expand Up @@ -100,16 +100,15 @@ protected function describeRoute(Route $route, array $options = array())
*/
protected function describeContainerParameters(ParameterBag $parameters, array $options = array())
{
$table = new TableHelper();
$table->setLayout(TableHelper::LAYOUT_COMPACT);
$table = new Table($this->output);
$table->setHeaders(array('Parameter', 'Value'));

foreach ($this->sortParameters($parameters) as $parameter => $value) {
$table->addRow(array($parameter, $this->formatParameter($value)));
}

$this->writeText($this->formatSection('container', 'List of parameters')."\n", $options);
$this->renderTable($table, !(isset($options['raw_output']) && $options['raw_output']));
$table->render();
}

/**
Expand Down Expand Up @@ -201,8 +200,7 @@ protected function describeContainerServices(ContainerBuilder $builder, array $o
$tagsCount = count($maxTags);
$tagsNames = array_keys($maxTags);

$table = new TableHelper();
$table->setLayout(TableHelper::LAYOUT_COMPACT);
$table = new Table($this->output);
$table->setHeaders(array_merge(array('Service ID'), $tagsNames, array('Class name')));

foreach ($this->sortServiceIds($serviceIds) as $serviceId) {
Expand Down Expand Up @@ -232,7 +230,7 @@ protected function describeContainerServices(ContainerBuilder $builder, array $o
}
}

$this->renderTable($table);
$table->render();
}

/**
Expand Down Expand Up @@ -302,31 +300,30 @@ protected function describeEventDispatcherListeners(EventDispatcherInterface $ev
$this->writeText($this->formatSection('event_dispatcher', $label)."\n", $options);

$registeredListeners = $eventDispatcher->getListeners($event);
$table = new Table($this->output);

if (null !== $event) {
$this->writeText("\n");
$table = new TableHelper();

$table->setHeaders(array('Order', 'Callable'));

foreach ($registeredListeners as $order => $listener) {
$table->addRow(array(sprintf('#%d', $order + 1), $this->formatCallable($listener)));
}

$this->renderTable($table);
} else {
ksort($registeredListeners);
foreach ($registeredListeners as $eventListened => $eventListeners) {
$this->writeText(sprintf("\n<info>[Event]</info> %s\n", $eventListened), $options);

$table = new TableHelper();
$table->setHeaders(array('Order', 'Callable'));

foreach ($eventListeners as $order => $eventListener) {
$table->addRow(array(sprintf('#%d', $order + 1), $this->formatCallable($eventListener)));
}

$this->renderTable($table);
}
}

$table->render();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ private function assertDescription($expectedDescription, $describedObject, array
if ('json' === $this->getFormat()) {
$this->assertEquals(json_decode($expectedDescription), json_decode($output->fetch()));
} else {
$this->assertEquals(trim($expectedDescription), trim(str_replace(PHP_EOL, "\n", $output->fetch())));
$this->assertEquals($expectedDescription, $output->fetch());
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
- Service: `service_1`
- Public: yes
- Public: yes
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
- Service: `service_2`
- Public: no
- Public: no
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ alias_2
Services
--------

- `service_container`: `Symfony\Component\DependencyInjection\ContainerBuilder`
- `service_container`: `Symfony\Component\DependencyInjection\ContainerBuilder`
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<info>[container]</info> <comment>Public</comment> services
Service ID Class name
alias_1 alias for "service_1"
alias_2 alias for "service_2"
definition_1 Full\Qualified\Class1
service_container Symfony\Component\DependencyInjection\ContainerBuilder
+-------------------+--------------------------------------------------------+
| Service ID | Class name |
+-------------------+--------------------------------------------------------+
| alias_1 | alias for "service_1" |
| alias_2 | alias for "service_2" |
| definition_1 | Full\Qualified\Class1 |
| service_container | Symfony\Component\DependencyInjection\ContainerBuilder |
+-------------------+--------------------------------------------------------+
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ alias_2
Services
--------

- `service_container`: `Symfony\Component\DependencyInjection\ContainerBuilder`
- `service_container`: `Symfony\Component\DependencyInjection\ContainerBuilder`
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<info>[container]</info> <comment>Public</comment> and <comment>private</comment> services
Service ID Class name
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

+-------------------+--------------------------------------------------------+
| Service ID | Class name |
+-------------------+--------------------------------------------------------+
| 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 |
+-------------------+--------------------------------------------------------+
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<info>[container]</info> <comment>Public</comment> and <comment>private</comment> services with tag <info>tag1</info>
Service ID attr1 attr2 attr3 Class name
definition_2 val1 val2 Full\Qualified\Class2
" val3
+--------------+-------+-------+-------+-----------------------+
| Service ID | attr1 | attr2 | attr3 | Class name |
+--------------+-------+-------+-------+-----------------------+
| definition_2 | val1 | val2 | | Full\Qualified\Class2 |
| " | | | val3 | |
+--------------+-------+-------+-------+-----------------------+
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@

- Type: `function`
- Name: `array_key_exists`
Original file line number Diff line number Diff line change
@@ -1 +1 @@
array_key_exists()
array_key_exists()
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

- Type: `function`
- Name: `staticMethod`
- Class: `Symfony\Bundle\FrameworkBundle\Tests\Console\Descriptor\CallableClass`
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Symfony\Bundle\FrameworkBundle\Tests\Console\Descriptor\CallableClass::staticMethod()
Symfony\Bundle\FrameworkBundle\Tests\Console\Descriptor\CallableClass::staticMethod()
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

- Type: `function`
- Name: `method`
- Class: `Symfony\Bundle\FrameworkBundle\Tests\Console\Descriptor\CallableClass`
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Symfony\Bundle\FrameworkBundle\Tests\Console\Descriptor\CallableClass::method()
Symfony\Bundle\FrameworkBundle\Tests\Console\Descriptor\CallableClass::method()
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

- Type: `function`
- Name: `staticMethod`
- Class: `Symfony\Bundle\FrameworkBundle\Tests\Console\Descriptor\CallableClass`
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Symfony\Bundle\FrameworkBundle\Tests\Console\Descriptor\CallableClass::staticMethod()
Symfony\Bundle\FrameworkBundle\Tests\Console\Descriptor\CallableClass::staticMethod()
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

- Type: `function`
- Name: `staticMethod`
- Class: `Symfony\Bundle\FrameworkBundle\Tests\Console\Descriptor\ExtendedCallableClass`
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Symfony\Bundle\FrameworkBundle\Tests\Console\Descriptor\ExtendedCallableClass::parent::staticMethod()
Symfony\Bundle\FrameworkBundle\Tests\Console\Descriptor\ExtendedCallableClass::parent::staticMethod()
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@

- Type: `closure`
Original file line number Diff line number Diff line change
@@ -1 +1 @@
\Closure()
\Closure()
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@

- Type: `object`
- Name: `Symfony\Bundle\FrameworkBundle\Tests\Console\Descriptor\CallableClass`

Original file line number Diff line number Diff line change
@@ -1 +1 @@
Symfony\Bundle\FrameworkBundle\Tests\Console\Descriptor\CallableClass::__invoke()
Symfony\Bundle\FrameworkBundle\Tests\Console\Descriptor\CallableClass::__invoke()
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
- Class: `Full\Qualified\Class1`
- Scope: `container`
- Public: yes
- Synthetic: no
- Synthetic: no
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
- Attr2: val2
- Tag: `tag1`
- Attr3: val3
- Tag: `tag2`
- Tag: `tag2`
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<info>[event_dispatcher]</info> Registered listeners for event <info>event1</info>

+-------+-------------------+
| Order | Callable |
| Order | Callable |
+-------+-------------------+
| #1 | global_function() |
| #2 | \Closure() |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
<info>[event_dispatcher]</info> Registered listeners by event

<info>[Event]</info> event1
+-------+-------------------+
| Order | Callable |
+-------+-------------------+
| #1 | global_function() |
| #2 | \Closure() |
+-------+-------------------+

<info>[Event]</info> event2
+-------+-----------------------------------------------------------------------------------+
| Order | Callable |
| Order | Callable |
+-------+-----------------------------------------------------------------------------------+
| #1 | global_function() |
| #2 | \Closure() |
| #1 | Symfony\Bundle\FrameworkBundle\Tests\Console\Descriptor\CallableClass::__invoke() |
+-------+-----------------------------------------------------------------------------------+
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
database_name
=============

symfony
symfony
Original file line number Diff line number Diff line change
@@ -1 +1 @@
symfony
symfony
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ Container parameters
- `array`: `[12,"Hello world!",true]`
- `boolean`: `true`
- `integer`: `12`
- `string`: `Hello world!`
- `string`: `Hello world!`
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<info>[container]</info> List of parameters
Parameter Value
array [12,"Hello world!",true]
boolean true
integer 12
string Hello world!

+-----------+--------------------------+
| Parameter | Value |
+-----------+--------------------------+
| array | [12,"Hello world!",true] |
| boolean | true |
| integer | 12 |
| string | Hello world! |
+-----------+--------------------------+
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
- Defaults:
- `name`: Joseph
- Requirements:
- `name`: [a-z]+
- `name`: [a-z]+
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
opt1: val1
opt2: val2
<comment>Path-Regex</comment> #^/hello(?:/(?P<name>[a-z]+))?$#s
<comment>Host-Regex</comment> #^localhost$#s
<comment>Host-Regex</comment> #^localhost$#s
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
- Method: PUT|POST
- Class: Symfony\Component\Routing\Route
- Defaults: NONE
- Requirements: NONE
- Requirements: NONE
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
opt1: val1
opt2: val2
<comment>Path-Regex</comment> #^/name/add$#s
<comment>Host-Regex</comment> #^localhost$#s
<comment>Host-Regex</comment> #^localhost$#s
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ route_2
- Class: Symfony\Component\Routing\Route
- Defaults: NONE
- Requirements: NONE

Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.