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

GetCommand   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 3
dl 0
loc 32
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 7 1
A execute() 0 15 1
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