WorkerStatusCommand   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 3
dl 0
loc 19
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 6 1
A execute() 0 9 2
1
<?php
2
namespace Tavii\SQSJobQueueBundle\Command;
3
4
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
5
use Symfony\Component\Console\Input\InputInterface;
6
use Symfony\Component\Console\Output\OutputInterface;
7
8
class WorkerStatusCommand extends ContainerAwareCommand
9
{
10
    protected function configure()
11
    {
12
        $this->setName('sqs_job_queue:worker-status')
13
            ->setDescription('check the status worker')
14
        ;
15
    }
16
17
    protected function execute(InputInterface $input, OutputInterface $output)
18
    {
19
        // @todo doctrine以外の対応
20
        $storage = $this->getContainer()->get('sqs_job_queue.storage.doctrine');
21
22
        foreach ($storage->all() as $worker) {
23
            $output->writeln("queue: {$worker->getQueue()}, prefix: {$worker->getPrefix()}, server: {$worker->getServer()}, pid: {$worker->getProcId()}");
24
        }
25
    }
26
}