WorkerRunCommand::execute()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 2
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
}