Security update for Core, with self-updated composer
[yaffs-website] / vendor / drupal / console / src / Command / Site / StatisticsCommand.php
index bd6f7bff1b15027a5ba9e125523f4d673565dd85..04880b3181c9cdc3daf0ed82a1a823589e9b8951 100644 (file)
@@ -9,9 +9,7 @@ namespace Drupal\Console\Command\Site;
 
 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;
@@ -22,10 +20,8 @@ use Drupal\Core\Extension\ModuleHandlerInterface;
  *
  * @package Drupal\Console\Command\Site
  */
-class StatisticsCommand extends Command
+class StatisticsCommand extends ContainerAwareCommand
 {
-    use ContainerAwareCommandTrait;
-
     /**
      * @var DrupalApi
      */
@@ -75,7 +71,8 @@ class StatisticsCommand extends Command
         $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']);
         ;
     }
 
@@ -84,8 +81,6 @@ class StatisticsCommand extends Command
      */
     protected function execute(InputInterface $input, OutputInterface $output)
     {
-        $io = new DrupalStyle($input, $output);
-
         $bundles = $this->drupalApi->getBundles();
         foreach ($bundles as $bundleType => $bundleName) {
             $key = sprintf(
@@ -105,7 +100,7 @@ class StatisticsCommand extends Command
         $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);
     }
 
 
@@ -218,10 +213,9 @@ class StatisticsCommand extends Command
     }
 
     /**
-     * @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'),
@@ -236,6 +230,6 @@ class StatisticsCommand extends Command
             ];
         }
 
-        $io->table($tableHeader, $tableRows);
+        $this->getIo()->table($tableHeader, $tableRows);
     }
 }