diff --git a/Console/CommandList.php b/Console/CommandList.php index 4f6ebae..e6dcd1c 100755 --- a/Console/CommandList.php +++ b/Console/CommandList.php @@ -3,13 +3,9 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Enqueue\Magento2\Console; -use Enqueue\Symfony\Client\ConsumeMessagesCommand; -use Enqueue\Symfony\Client\Meta\QueuesCommand; -use Enqueue\Symfony\Client\Meta\TopicsCommand; -use Enqueue\Symfony\Client\ProduceMessageCommand; -use Enqueue\Symfony\Client\SetupBrokerCommand; /** * Provides list of commands to be available for uninstalled application */ @@ -70,22 +66,6 @@ public function __construct( $this->consumeMessagesCommandFactory = $consumeMessagesCommand; } - /** - * Gets list of command classes - * - * @return string[] - */ - private function getCommandsClasses() - { - return [ - SetupBrokerCommand::class, - ProduceMessageCommand::class, - TopicsCommand::class, - ConsumeMessagesCommand::class, - QueuesCommand::class, - ]; - } - /** * @inheritdoc */ @@ -96,24 +76,18 @@ public function getCommands() $this->enqueueManager->bindProcessors(); $client = $this->enqueueManager->getClient(); - foreach ($this->getCommandsClasses() as $class) { - if (class_exists($class)) { - $commands[] = $this->setupBrokerCommandFactory->create(['driver' => $client->getDriver()]); - $commands[] = $this->produceMessageCommandFactory->create(['producer' => $client->getProducer()]); - $commands[] = $this->queuesCommandFactory->create(['queueRegistry' => $client->getQueueMetaRegistry()]); - $commands[] = $this->topicsCommandFactory->create(['topicRegistry' => $client->getTopicMetaRegistry()]); - $commands[] = $this->consumeMessagesCommandFactory->create( - [ - 'consumer' => $client->getQueueConsumer(), - 'processor' => $client->getDelegateProcessor(), - 'queueMetaRegistry' => $client->getQueueMetaRegistry(), - 'driver' => $client->getDriver() - ] - ); - } else { - throw new \Exception('Class ' . $class . ' does not exist'); - } - } + $commands[] = $this->setupBrokerCommandFactory->create(['driver' => $client->getDriver()]); + $commands[] = $this->produceMessageCommandFactory->create(['producer' => $client->getProducer()]); + $commands[] = $this->queuesCommandFactory->create(['queueRegistry' => $client->getQueueMetaRegistry()]); + $commands[] = $this->topicsCommandFactory->create(['topicRegistry' => $client->getTopicMetaRegistry()]); + $commands[] = $this->consumeMessagesCommandFactory->create( + [ + 'consumer' => $client->getQueueConsumer(), + 'processor' => $client->getDelegateProcessor(), + 'queueMetaRegistry' => $client->getQueueMetaRegistry(), + 'driver' => $client->getDriver() + ] + ); return $commands; }