QueueFlushCommand   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 7 1
A execute() 0 10 2
1
<?php
2
3
/*
4
 * This file is part of HeriJobQueueBundle.
5
 *
6
 * (c) Alexandre Mogère
7
 *
8
 * This source file is subject to the MIT license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
namespace Heri\Bundle\JobQueueBundle\Command;
13
14
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
15
use Symfony\Component\Console\Input\InputInterface;
16
use Symfony\Component\Console\Output\OutputInterface;
17
18
class QueueFlushCommand extends ContainerAwareCommand
19
{
20
    /**
21
     * {@inheritdoc}
22
     */
23
    protected function configure()
24
    {
25
        $this
26
            ->setName('jobqueue:flush')
27
            ->setDescription('Delete all of your failed jobs')
28
        ;
29
    }
30
31
    /**
32
     * {@inheritdoc}
33
     */
34
    protected function execute(InputInterface $input, OutputInterface $output)
35
    {
36
        $queue = $this->getContainer()->get('jobqueue');
37
38
        if ($queue->flush()) {
39
            $output->writeLn('<info>Cleaned exceptions</info>');
40
        } else {
41
            $output->writeLn('<info>Flush failed</info>');
42
        }
43
    }
44
}
45