Skip to content

Commit

Permalink
minor #34768 [FrameworkBundle] Remove env var table from AboutCommand…
Browse files Browse the repository at this point in the history
… (tuqqu)

This PR was squashed before being merged into the 5.1-dev branch.

Discussion
----------

[FrameworkBundle] Remove env var table from AboutCommand

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | -
| Deprecations? | -
| Tickets       | -
| License       | MIT
| Doc PR        | -

Fixed AboutCommand output by shortening environment variable value (replacing with `...`) to fit the screen width if the value is too long.

Right now all output is a mess if it does not fit in the terminal window.

Commits
-------

6962da9 [FrameworkBundle] Remove env var table from AboutCommand
  • Loading branch information
nicolas-grekas committed Dec 26, 2019
2 parents d021ff1 + 6962da9 commit 40c2ce4
Showing 1 changed file with 0 additions and 22 deletions.
22 changes: 0 additions & 22 deletions src/Symfony/Bundle/FrameworkBundle/Command/AboutCommand.php
Expand Up @@ -89,16 +89,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int
['Xdebug', \extension_loaded('xdebug') ? 'true' : 'false'],
];

if ($dotenv = self::getDotenvVars()) {
$rows = array_merge($rows, [
new TableSeparator(),
['<info>Environment (.env)</>'],
new TableSeparator(),
], array_map(function ($value, $name) {
return [$name, $value];
}, $dotenv, array_keys($dotenv)));
}

$io->table([], $rows);

return 0;
Expand Down Expand Up @@ -129,16 +119,4 @@ private static function isExpired(string $date): bool

return false !== $date && new \DateTime() > $date->modify('last day of this month 23:59:59');
}

private static function getDotenvVars(): array
{
$vars = [];
foreach (explode(',', $_SERVER['SYMFONY_DOTENV_VARS'] ?? $_ENV['SYMFONY_DOTENV_VARS'] ?? '') as $name) {
if ('' !== $name && isset($_ENV[$name])) {
$vars[$name] = $_ENV[$name];
}
}

return $vars;
}
}

0 comments on commit 40c2ce4

Please sign in to comment.