WorkerRunCommand   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 6 1
A execute() 0 6 1
1
<?php
2
namespace Tavii\SQSJobQueueBundle\Command;
3
4
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
5
use Symfony\Component\Console\Input\InputArgument;
6
use Symfony\Component\Console\Input\InputInterface;
7
use Symfony\Component\Console\Output\OutputInterface;
8
use Tavii\SQSJobQueue\Queue\QueueName;
9
10
class WorkerRunCommand extends ContainerAwareCommand
11
{
12
    protected function configure()
13
    {
14
        $this->setName('sqs_job_queue:worker-run')
15
            ->setDescription('run a sqs job queue worker')
16
            ->addArgument('queue', InputArgument::REQUIRED, 'Queue name');
17
    }
18
19
    protected function execute(InputInterface $input, OutputInterface $output)
20
    {
21
        $queueName = new QueueName($input->getArgument('queue'), $this->getContainer()->getParameter('sqs_job_queue.prefix'));
22
        $worker = $this->getContainer()->get('sqs_job_queue.worker');
23
        $worker->run($queueName);
24
    }
25
}