Completed
Push — master ( 0585fd...6ce168 )
by Mickael
03:38
created

GearmanWorkerDescribeCommand::execute()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 14
ccs 0
cts 13
cp 0
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 10
nc 1
nop 2
crap 2
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
    protected function configure()
31
    {
32
        parent::configure();
33
34
        $this
35
            ->setName('gearman:worker:describe')
36
            ->setDescription('Describe given worker')
37
            ->addArgument(
38
                'worker',
39
                InputArgument::REQUIRED,
40
                'worker to describe'
41
            );
42
    }
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
    protected function execute(InputInterface $input, OutputInterface $output)
55
    {
56
        $worker = $input->getArgument('worker');
57
        $worker = $this
58
            ->getContainer()->get('gearman')
59
            ->getWorker($worker);
60
61
        $this
62
            ->getContainer()->get('gearman.describer')
63
            ->describeWorker(
64
                $output,
65
                $worker
66
            );
67
    }
68
}
0 ignored issues
show
Coding Style introduced by
As per coding style, files should not end with a newline character.

This check marks files that end in a newline character, i.e. an empy line.

Loading history...
69