Security update for Core, with self-updated composer
[yaffs-website] / vendor / drupal / console / src / Command / Debug / ThemeCommand.php
similarity index 64%
rename from vendor/drupal/console/src/Command/Theme/DebugCommand.php
rename to vendor/drupal/console/src/Command/Debug/ThemeCommand.php
index 4ed696e4d26e744c8047e2aba6b067484f66862d..464dd7ca5e071fca32689826053eec50c136a492 100644 (file)
@@ -2,24 +2,20 @@
 
 /**
  * @file
- * Contains \Drupal\Console\Command\Theme\Debugommand.
+ * Contains \Drupal\Console\Command\Debug\ThemeCommand.
  */
 
-namespace Drupal\Console\Command\Theme;
+namespace Drupal\Console\Command\Debug;
 
 use Symfony\Component\Console\Input\InputArgument;
 use Symfony\Component\Console\Input\InputInterface;
 use Symfony\Component\Console\Output\OutputInterface;
-use Symfony\Component\Console\Command\Command;
-use Drupal\Console\Core\Command\Shared\CommandTrait;
+use Drupal\Console\Core\Command\Command;
 use Drupal\Core\Config\ConfigFactory;
 use Drupal\Core\Extension\ThemeHandler;
-use Drupal\Console\Core\Style\DrupalStyle;
 
-class DebugCommand extends Command
+class ThemeCommand extends Command
 {
-    use CommandTrait;
-
     /**
      * @var ConfigFactory
      */
@@ -48,30 +44,33 @@ class DebugCommand extends Command
     protected function configure()
     {
         $this
-            ->setName('theme:debug')
-            ->setDescription($this->trans('commands.theme.debug.description'))
-            ->addArgument('theme', InputArgument::OPTIONAL, $this->trans('commands.theme.debug.arguments.theme'));
+            ->setName('debug:theme')
+            ->setDescription($this->trans('commands.debug.theme.description'))
+            ->addArgument(
+                'theme',
+                InputArgument::OPTIONAL,
+                $this->trans('commands.debug.theme.arguments.theme')
+            )
+            ->setAliases(['dt']);
     }
 
     protected function execute(InputInterface $input, OutputInterface $output)
     {
-        $io = new DrupalStyle($input, $output);
-
         $theme = $input->getArgument('theme');
         if ($theme) {
-            $this->themeDetail($io, $theme);
+            $this->themeDetail($theme);
         } else {
-            $this->themeList($io);
+            $this->themeList();
         }
     }
 
-    protected function themeList(DrupalStyle $io)
+    protected function themeList()
     {
         $tableHeader = [
-            $this->trans('commands.theme.debug.messages.theme-id'),
-            $this->trans('commands.theme.debug.messages.theme-name'),
-            $this->trans('commands.theme.debug.messages.status'),
-            $this->trans('commands.theme.debug.messages.version'),
+            $this->trans('commands.debug.theme.messages.theme-id'),
+            $this->trans('commands.debug.theme.messages.theme-name'),
+            $this->trans('commands.debug.theme.messages.status'),
+            $this->trans('commands.debug.theme.messages.version'),
         ];
 
         $themes = $this->themeHandler->rebuildThemeData();
@@ -84,10 +83,10 @@ class DebugCommand extends Command
             ];
         }
 
-        $io->table($tableHeader, $tableRows);
+        $this->getIo()->table($tableHeader, $tableRows);
     }
 
-    protected function themeDetail(DrupalStyle $io, $themeId)
+    protected function themeDetail($themeId)
     {
         $theme = null;
         $themes = $this->themeHandler->rebuildThemeData();
@@ -108,31 +107,31 @@ class DebugCommand extends Command
             $theme = $themes[$themeId];
             $status = $this->getThemeStatus($themeId);
 
-            $io->info($theme->info['name']);
+            $this->getIo()->info($theme->info['name']);
 
-            $io->comment(
+            $this->getIo()->comment(
                 sprintf(
                     '%s : ',
-                    $this->trans('commands.theme.debug.messages.status')
+                    $this->trans('commands.debug.theme.messages.status')
                 ),
                 false
             );
-            $io->writeln($status);
-            $io->comment(
+            $this->getIo()->writeln($status);
+            $this->getIo()->comment(
                 sprintf(
                     '%s : ',
-                    $this->trans('commands.theme.debug.messages.version')
+                    $this->trans('commands.debug.theme.messages.version')
                 ),
                 false
             );
-            $io->writeln($theme->info['version']);
-            $io->comment($this->trans('commands.theme.debug.messages.regions'));
+            $this->getIo()->writeln($theme->info['version']);
+            $this->getIo()->comment($this->trans('commands.debug.theme.messages.regions'));
             $tableRows = $this->addThemeAttributes($theme->info['regions'], $tableRows);
-            $io->table([], $tableRows);
+            $this->getIo()->table([], $tableRows);
         } else {
-            $io->error(
+            $this->getIo()->error(
                 sprintf(
-                    $this->trans('commands.theme.debug.messages.invalid-theme'),
+                    $this->trans('commands.debug.theme.messages.invalid-theme'),
                     $themeId
                 )
             );
@@ -143,9 +142,9 @@ class DebugCommand extends Command
     {
         $defaultTheme = $this->configFactory->get('system.theme')->get('default');
 
-        $status = ($theme->status)?$this->trans('commands.theme.debug.messages.installed'):$this->trans('commands.theme.debug.messages.uninstalled');
+        $status = ($theme->status)?$this->trans('commands.debug.theme.messages.installed'):$this->trans('commands.debug.theme.messages.uninstalled');
         if ($defaultTheme == $theme) {
-            $status = $this->trans('commands.theme.debug.messages.default-theme');
+            $status = $this->trans('commands.debug.theme.messages.default-theme');
         }
 
         return $status;