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 |
|
|
|
|
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
|
|
|
$output, |
65
|
|
|
$worker |
66
|
|
|
); |
67
|
1 |
|
} |
68
|
|
|
} |
|
|
|
|
69
|
|
|
|
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.