use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
-use Symfony\Component\Console\Command\Command;
-use Drupal\Console\Core\Command\Shared\ContainerAwareCommandTrait;
-use Drupal\Console\Core\Style\DrupalStyle;
+use Drupal\Console\Core\Command\ContainerAwareCommand;
use Drupal\Console\Utils\DrupalApi;
use Drupal\Core\Entity\Query\QueryFactory;
use Drupal\Console\Extension\Manager;
*
* @package Drupal\Console\Command\Site
*/
-class StatisticsCommand extends Command
+class StatisticsCommand extends ContainerAwareCommand
{
- use ContainerAwareCommandTrait;
-
/**
* @var DrupalApi
*/
$this
->setName('site:statistics')
->setDescription($this->trans('commands.site.statistics.description'))
- ->setHelp($this->trans('commands.site.statistics.help'));
+ ->setHelp($this->trans('commands.site.statistics.help'))
+ ->setAliases(['sst']);
;
}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
- $io = new DrupalStyle($input, $output);
-
$bundles = $this->drupalApi->getBundles();
foreach ($bundles as $bundleType => $bundleName) {
$key = sprintf(
$statistics[$this->trans('commands.site.statistics.messages.themes-enabled')] = $this->getThemeCount(true);
$statistics[$this->trans('commands.site.statistics.messages.themes-disabled')] = $this->getThemeCount(false);
- $this->statisticsList($io, $statistics);
+ $this->statisticsList($statistics);
}
}
/**
- * @param DrupalStyle $io
* @param mixed $statistics
*/
- private function statisticsList(DrupalStyle $io, $statistics)
+ private function statisticsList($statistics)
{
$tableHeader =[
$this->trans('commands.site.statistics.messages.stat-name'),
];
}
- $io->table($tableHeader, $tableRows);
+ $this->getIo()->table($tableHeader, $tableRows);
}
}