GetCommand::configure()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 7
ccs 5
cts 5
cp 1
rs 9.4285
cc 1
eloc 5
nc 1
nop 0
crap 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 2
    protected function configure()
20
    {
21
        $this
22 2
            ->setName('innmind:amqp:get')
23 2
            ->setDescription('Will process a single message from the given queue')
24 2
            ->addArgument('queue', InputArgument::REQUIRED);
25 2
    }
26
27
    /**
28
     * {@inheritdoc}
29
     */
30 2
    protected function execute(InputInterface $input, OutputInterface $output)
31
    {
32 2
        $queue = $input->getArgument('queue');
33
        $consume = $this
34 2
            ->getContainer()
35 2
            ->get('innmind.amqp.consumers')
36 2
            ->get($queue);
37
38
        $this
39 2
            ->getContainer()
40 2
            ->get('innmind.amqp.client')
41 2
            ->channel()
42 2
            ->basic()
43 2
            ->get(new Get($queue))($consume);
44 2
    }
45
}
46