QueueListCommand   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 4
dl 0
loc 28
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 7 1
A execute() 0 11 2
1
<?php
2
namespace Tavii\SQSJobQueueBundle\Command;
3
4
5
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
6
use Symfony\Component\Console\Input\InputInterface;
7
use Symfony\Component\Console\Input\InputOption;
8
use Symfony\Component\Console\Output\OutputInterface;
9
10
class QueueListCommand extends ContainerAwareCommand
11
{
12
    /**
13
     * {@inheritdoc}
14
     */
15
    protected function configure()
16
    {
17
        $this->setName('sqs_job_queue:queue-list')
18
            ->setDescription('list queue')
19
            ->addOption('queueNamePrefix', 'Q',InputOption::VALUE_OPTIONAL, 'QueueNamePrefix', '')
20
        ;
21
    }
22
23
    /**
24
     * {@inheritdoc}
25
     */
26
    public function execute(InputInterface $input, OutputInterface $output)
27
    {
28
        $client = $this->getContainer()->get('sqs_job_queue.client');
29
        $results = $client->listQueues(array(
30
            'QueueNamePrefix' => $input->getOption('queueNamePrefix'),
31
        ));
32
33
        foreach ($results['QueueUrls'] as $queueUrl) {
34
            $output->writeln("<info>queue url:</info> $queueUrl");
35
        }
36
    }
37
}