Completed
Pull Request — master (#2)
by Wachter
05:49 queued 01:29
created

RunHandlerCommand::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 6
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 6
loc 6
rs 9.4286
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
3
namespace Task\TaskBundle\Command;
4
5
use Symfony\Component\Console\Command\Command;
6
use Symfony\Component\Console\Input\InputArgument;
7
use Symfony\Component\Console\Input\InputInterface;
8
use Symfony\Component\Console\Output\OutputInterface;
9
use Task\Handler\RegistryInterface;
10
use Task\SchedulerInterface;
11
12
/**
13
 * Run pending tasks.
14
 *
15
 * @author @wachterjohannes <[email protected]>
16
 */
17 View Code Duplication
class RunHandlerCommand extends Command
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
18
{
19
    /**
20
     * @var RegistryInterface
21
     */
22
    private $registry;
23
24
    public function __construct(RegistryInterface $registry)
25
    {
26
        parent::__construct('task:run:handler');
27
28
        $this->registry = $registry;
29
    }
30
31
    /**
32
     * {@inheritdoc}
33
     */
34
    protected function configure()
35
    {
36
        $this->setDescription('Run pending tasks')
37
            ->addArgument('handler', InputArgument::REQUIRED)
38
            ->addArgument('workload', InputArgument::OPTIONAL);
39
    }
40
41
    /**
42
     * {@inheritdoc}
43
     */
44
    protected function execute(InputInterface $input, OutputInterface $output)
45
    {
46
        $this->registry->run($input->getArgument('handler'), $input->getArgument('workload'));
47
    }
48
}
49