Skip to content

Commit

Permalink
Apply fixes from StyleCI
Browse files Browse the repository at this point in the history
  • Loading branch information
StyleCIBot committed Aug 10, 2022
1 parent b58e889 commit 5e68c38
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 18 deletions.
8 changes: 3 additions & 5 deletions src/Illuminate/Database/Console/DatabaseInspectionCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,13 @@
namespace Illuminate\Database\Console;

use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Schema\Schema;
use Illuminate\Console\Command;
use Illuminate\Database\ConnectionInterface;
use Illuminate\Database\MySqlConnection;
use Illuminate\Database\PostgresConnection;
use Illuminate\Database\SQLiteConnection;
use Illuminate\Support\Arr;
use Illuminate\Support\Composer;
use Illuminate\Support\Str;
use Symfony\Component\Process\Exception\ProcessSignaledException;
use Symfony\Component\Process\Exception\RuntimeException;
use Symfony\Component\Process\Process;
Expand Down Expand Up @@ -145,7 +143,7 @@ protected function getConfigFromDatabase($database)
{
$database ??= config('database.default');

return Arr::except(config('database.connections.' . $database), ['password']);
return Arr::except(config('database.connections.'.$database), ['password']);
}

/**
Expand All @@ -155,8 +153,8 @@ protected function getConfigFromDatabase($database)
*/
protected function ensureDependenciesExist()
{
if (!interface_exists('Doctrine\DBAL\Driver')) {
if (!$this->components->confirm('Displaying model information requires the Doctrine DBAL (doctrine/dbal) package. Would you like to install it?')) {
if (! interface_exists('Doctrine\DBAL\Driver')) {
if (! $this->components->confirm('Displaying model information requires the Doctrine DBAL (doctrine/dbal) package. Would you like to install it?')) {
return 1;
}

Expand Down
10 changes: 5 additions & 5 deletions src/Illuminate/Database/Console/ShowCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ protected function displayForCli(array $data)

$this->newLine();

$this->components->twoColumnDetail('<fg=green;options=bold>' . $platform['name'] . '</>');
$this->components->twoColumnDetail('<fg=green;options=bold>'.$platform['name'].'</>');
$this->components->twoColumnDetail('Database', Arr::get($platform['config'], 'database'));
$this->components->twoColumnDetail('Host', Arr::get($platform['config'], 'host'));
$this->components->twoColumnDetail('Port', Arr::get($platform['config'], 'port'));
Expand All @@ -145,22 +145,22 @@ protected function displayForCli(array $data)
$this->components->twoColumnDetail('Tables', $tables->count());

if ($tableSizeSum = $tables->sum('size')) {
$this->components->twoColumnDetail('Total Size', number_format($tableSizeSum / 1024 / 1024, 2) . 'Mb');
$this->components->twoColumnDetail('Total Size', number_format($tableSizeSum / 1024 / 1024, 2).'Mb');
}

$this->newLine();

if ($tables->isNotEmpty()) {
$this->components->twoColumnDetail('<fg=green;options=bold>Table</>', 'Size (Mb)' . ($this->option('counts') ? ' <fg=gray;options=bold>/</> <fg=yellow;options=bold>Rows</>' : ''));
$this->components->twoColumnDetail('<fg=green;options=bold>Table</>', 'Size (Mb)'.($this->option('counts') ? ' <fg=gray;options=bold>/</> <fg=yellow;options=bold>Rows</>' : ''));

$tables->each(function ($table) {
if ($tableSize = $table['size']) {
$tableSize = number_format($tableSize / 1024 / 1024, 2);
}

$this->components->twoColumnDetail(
$table['table'] . ($this->output->isVerbose() ? ' <fg=gray>' . $table['engine'] . '</>' : null),
($tableSize ? $tableSize : '') . ($this->option('counts') ? ' <fg=gray;options=bold>/</> <fg=yellow;options=bold>' . number_format($table['rows']) . '</>' : '')
$table['table'].($this->output->isVerbose() ? ' <fg=gray>'.$table['engine'].'</>' : null),
($tableSize ? $tableSize : '').($this->option('counts') ? ' <fg=gray;options=bold>/</> <fg=yellow;options=bold>'.number_format($table['rows']).'</>' : '')
);

if ($this->output->isVerbose()) {
Expand Down
16 changes: 8 additions & 8 deletions src/Illuminate/Database/Console/TableCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ protected function getAttributesForColumn(Column $column)
$column->getAutoincrement() ? 'autoincrement' : null,
'type' => $column->getType()->getName(),
$column->getUnsigned() ? 'unsigned' : null,
!$column->getNotNull() ? 'nullable' : null,
! $column->getNotNull() ? 'nullable' : null,
])->filter();
}

Expand Down Expand Up @@ -188,11 +188,11 @@ protected function displayForCli(array $data)

$this->newLine();

$this->components->twoColumnDetail('<fg=green;options=bold>' . $table['name'] . '</>');
$this->components->twoColumnDetail('<fg=green;options=bold>'.$table['name'].'</>');
$this->components->twoColumnDetail('Columns', $table['columns']);

if ($size = $table['size']) {
$this->components->twoColumnDetail('Size', number_format($size / 1024 / 1024, 2) . 'Mb');
$this->components->twoColumnDetail('Size', number_format($size / 1024 / 1024, 2).'Mb');
}

$this->newLine();
Expand All @@ -202,8 +202,8 @@ protected function displayForCli(array $data)

$columns->each(function ($column) {
$this->components->twoColumnDetail(
$column['column'] . ' <fg=gray>' . $column['attributes']->implode(', ') . '</>',
($column['default'] ? '<fg=gray>' . $column['default'] . '</> ' : '') . '' . $column['type'] . ''
$column['column'].' <fg=gray>'.$column['attributes']->implode(', ').'</>',
($column['default'] ? '<fg=gray>'.$column['default'].'</> ' : '').''.$column['type'].''
);
});

Expand All @@ -215,7 +215,7 @@ protected function displayForCli(array $data)

$indexes->each(function ($index) {
$this->components->twoColumnDetail(
$index['name'] . ' <fg=gray>' . $index['columns']->implode(', ') . '</>',
$index['name'].' <fg=gray>'.$index['columns']->implode(', ').'</>',
$index['attributes']->implode(', ')
);
});
Expand All @@ -228,8 +228,8 @@ protected function displayForCli(array $data)

$foreignKeys->each(function ($foreignKey) {
$this->components->twoColumnDetail(
$foreignKey['name'] . ' <fg=gray;options=bold>' . $foreignKey['local_columns']->implode(', ') . ' references ' . $foreignKey['foreign_columns']->implode(', ') . ' on ' . $foreignKey['foreign_table'] . '</>',
$foreignKey['on_update'] . ' / ' . $foreignKey['on_delete'],
$foreignKey['name'].' <fg=gray;options=bold>'.$foreignKey['local_columns']->implode(', ').' references '.$foreignKey['foreign_columns']->implode(', ').' on '.$foreignKey['foreign_table'].'</>',
$foreignKey['on_update'].' / '.$foreignKey['on_delete'],
);
});

Expand Down

0 comments on commit 5e68c38

Please sign in to comment.