Completed
Push — develop ( 53c9e6...feab1b )
by Baptiste
07:33
created

GetCommand::configure()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 0
1
<?php
2
declare(strict_types = 1);
3
4
namespace Innmind\AMQPBundle\Command;
5
6
use Innmind\AMQP\Model\Basic\Get;
7
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
8
use Symfony\Component\Console\{
9
    Input\InputInterface,
10
    Input\InputArgument,
11
    Output\OutputInterface
12
};
13
14
final class GetCommand extends ContainerAwareCommand
15
{
16
    /**
17
     * {@inheritdoc}
18
     */
19
    protected function configure()
20
    {
21
        $this
22
            ->setName('innmind:amqp:get')
23
            ->setDescription('Will process a single message from the given queue')
24
            ->addArgument('queue', InputArgument::REQUIRED);
25
    }
26
27
    /**
28
     * {@inheritdoc}
29
     */
30
    protected function execute(InputInterface $input, OutputInterface $output)
31
    {
32
        $queue = $input->getArgument('queue');
33
        $consume = $this
34
            ->getContainer()
35
            ->get('innmind.amqp.consumers')
36
            ->get($queue);
37
38
        $this
39
            ->getContainer()
40
            ->get('innmind.amqp.client')
41
            ->channel()
42
            ->basic()
43
            ->get(new Get($queue))($consume);
44
    }
45
}
46