| Conditions | 2 |
| Paths | 2 |
| Total Lines | 27 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 14 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 19 | 2 | public function indexAction() |
|
| 20 | { |
||
| 21 | /** @var \Zend\Console\Request $request */ |
||
| 22 | 2 | $request = $this->getRequest(); |
|
| 23 | /** @var \Zend\Console\Response $response */ |
||
| 24 | 2 | $response = $this->getResponse(); |
|
| 25 | |||
| 26 | 2 | $this->getConsole()->writeLine(sprintf('Starting rpc server %s', $request->getParam('name'))); |
|
| 27 | |||
| 28 | 2 | $serviceName = sprintf('rabbitmq_module.rpc_server.%s', $request->getParam('name')); |
|
| 29 | |||
| 30 | 2 | if (!$this->container->has($serviceName)) { |
|
| 31 | 1 | $this->getConsole()->writeLine( |
|
| 32 | 1 | sprintf('No rpc server with name "%s" found', $request->getParam('name')), |
|
| 33 | ColorInterface::RED |
||
| 34 | 1 | ); |
|
| 35 | 1 | $response->setErrorLevel(1); |
|
| 36 | |||
| 37 | 1 | return $response; |
|
| 38 | } |
||
| 39 | |||
| 40 | /** @var \RabbitMqModule\RpcServer $consumer */ |
||
| 41 | 1 | $consumer = $this->container->get($serviceName); |
|
| 42 | 1 | $consumer->consume(); |
|
| 43 | |||
| 44 | 1 | return $response; |
|
| 45 | } |
||
| 46 | } |
||
| 47 |