| Conditions | 4 |
| Paths | 4 |
| Total Lines | 28 |
| Code Lines | 19 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 18 |
| CRAP Score | 4 |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 35 | 6 | protected function execute(InputInterface $input, OutputInterface $output) |
|
| 36 | { |
||
| 37 | 6 | $queue = $input->getArgument('queue'); |
|
| 38 | 6 | $number = $input->getArgument('number'); |
|
| 39 | 6 | $prefetch = $input->getArgument('prefetch'); |
|
| 40 | $consume = $this |
||
| 41 | 6 | ->getContainer() |
|
| 42 | 6 | ->get('innmind.amqp.consumers') |
|
| 43 | 6 | ->get($queue); |
|
| 44 | |||
| 45 | $basic = $this |
||
| 46 | 6 | ->getContainer() |
|
| 47 | 6 | ->get('innmind.amqp.client') |
|
| 48 | 6 | ->channel() |
|
| 49 | 6 | ->basic(); |
|
| 50 | |||
| 51 | 6 | if (!is_null($number) || !is_null($prefetch)) { |
|
| 52 | 4 | $basic->qos(new Qos(0, (int) ($prefetch ?? $number))); |
|
| 53 | } |
||
| 54 | |||
| 55 | 6 | $consumer = $basic->consume(new Consume($queue)); |
|
| 56 | |||
| 57 | 6 | if (!is_null($number)) { |
|
| 58 | 4 | $consumer->take((int) $number); |
|
| 59 | } |
||
| 60 | |||
| 61 | 6 | $consumer->foreach($consume); |
|
| 62 | 6 | } |
|
| 63 | } |
||
| 64 |