| 1 | <?php |
||
| 14 | class WorkerRunnerManager |
||
| 15 | { |
||
| 16 | /** |
||
| 17 | * Worker runner services configuration. |
||
| 18 | * |
||
| 19 | * @var array |
||
| 20 | */ |
||
| 21 | private $runners = array(); |
||
| 22 | |||
| 23 | /** |
||
| 24 | * Register runner. |
||
| 25 | * |
||
| 26 | * @param string $name Worker name. |
||
| 27 | * @param WorkerRunnerInterface $runner Worker runner. |
||
| 28 | * @param array $options Worker options. |
||
| 29 | */ |
||
| 30 | public function addRunner($name, WorkerRunnerInterface $runner, array $options = array()) |
||
| 37 | |||
| 38 | /** |
||
| 39 | * Return true, if worker with given name is registered, false otherwise. |
||
| 40 | * |
||
| 41 | * @param string $name |
||
| 42 | * @return boolean |
||
| 43 | */ |
||
| 44 | public function has($name) |
||
| 48 | |||
| 49 | /** |
||
| 50 | * Run worker. |
||
| 51 | * |
||
| 52 | * @param string $name |
||
| 53 | * @param OutputInterface $output |
||
| 54 | * @throws InvalidArgumentException Thrown, if worker cannto be found for provided name. |
||
| 55 | * @throws Exception Can be thrown, if runner resulted with an error. |
||
| 56 | */ |
||
| 57 | public function run($name, OutputInterface $output = null) |
||
| 66 | |||
| 67 | /** |
||
| 68 | * Get registered runners. |
||
| 69 | * |
||
| 70 | * @return string[] |
||
|
1 ignored issue
–
show
|
|||
| 71 | */ |
||
| 72 | public function getRunners() |
||
| 76 | |||
| 77 | } |
||
| 78 |
This check compares the return type specified in the
@returnannotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.