GearmanWorkerDescribeCommand   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 3
dl 0
loc 44
ccs 18
cts 18
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 13 1
A execute() 0 14 1
1
<?php
2
3
/**
4
 * Gearman Bundle for Symfony2 / Symfony3
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 *
9
 * Feel free to edit as you please, and have fun.
10
 *
11
 * @author Marc Morera <[email protected]>
12
 * @author Mickael Perraud <[email protected]>
13
 */
14
15
namespace Mkk\GearmanBundle\Command;
16
17
use Symfony\Component\Console\Input\InputArgument;
18
use Symfony\Component\Console\Input\InputInterface;
19
use Symfony\Component\Console\Output\OutputInterface;
20
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
21
22
/**
23
 * Gearman Job Describe Command class
24
 */
25
class GearmanWorkerDescribeCommand extends ContainerAwareCommand
26
{
27
    /**
28
     * Console Command configuration
29
     */
30 16
    protected function configure()
31
    {
32 16
        parent::configure();
33
34
        $this
35 16
            ->setName('gearman:worker:describe')
36 16
            ->setDescription('Describe given worker')
37 16
            ->addArgument(
38 16
                'worker',
39 16
                InputArgument::REQUIRED,
40 16
                'worker to describe'
41
            );
42 16
    }
43
44
    /**
45
     * Executes the current command.
46
     *
47
     * @param InputInterface  $input  An InputInterface instance
48
     * @param OutputInterface $output An OutputInterface instance
49
     *
50
     * @return integer 0 if everything went fine, or an error code
0 ignored issues
show
Documentation introduced by
Should the return type not be integer|null?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
51
     *
52
     * @throws \LogicException When this abstract class is not implemented
53
     */
54 1
    protected function execute(InputInterface $input, OutputInterface $output)
55
    {
56 1
        $worker = $input->getArgument('worker');
57
        $worker = $this
58 1
            ->getContainer()->get('gearman')
59 1
            ->getWorker($worker);
60
61
        $this
62 1
            ->getContainer()->get('gearman.describer')
63 1
            ->describeWorker(
64 1
                $output,
65 1
                $worker
66
            );
67 1
    }
68
}
69