5 * Contains \Drupal\Console\Command\Queue\DebugCommand.
8 namespace Drupal\Console\Command\Queue;
10 use Symfony\Component\Console\Command\Command;
11 use Symfony\Component\Console\Input\InputInterface;
12 use Symfony\Component\Console\Output\OutputInterface;
13 use Drupal\Core\Queue\QueueWorkerManagerInterface;
14 use Drupal\Console\Core\Command\Shared\CommandTrait;
15 use Drupal\Console\Core\Style\DrupalStyle;
20 * @package Drupal\Console\Command\Queue
22 class DebugCommand extends Command
27 * @var QueueWorkerManagerInterface
29 protected $queueWorker;
32 * DebugCommand constructor.
34 * @param QueueWorkerManagerInterface $queueWorker
36 public function __construct(QueueWorkerManagerInterface $queueWorker)
38 $this->queueWorker = $queueWorker;
39 parent::__construct();
45 protected function configure()
48 ->setName('queue:debug')
49 ->setDescription($this->trans('commands.queue.debug.description'));
55 protected function execute(InputInterface $input, OutputInterface $output)
57 $io = new DrupalStyle($input, $output);
60 $this->trans('commands.queue.debug.messages.queue'),
61 $this->trans('commands.queue.debug.messages.items'),
62 $this->trans('commands.queue.debug.messages.class')
65 $tableBody = $this->listQueues();
67 $io->table($tableHeader, $tableBody);
75 private function listQueues()
78 foreach ($this->queueWorker->getDefinitions() as $name => $info) {
79 $queues[$name] = $this->formatQueue($name);
89 private function formatQueue($name)
91 $q = $this->getDrupalService('queue')->get($name);