DeclareCommand::configure()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 3
Bugs 2 Features 1
Metric Value
eloc 2
c 3
b 2
f 1
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
cc 1
nc 1
nop 0
crap 2
1
<?php declare(strict_types = 1);
2
3
namespace Portiny\RabbitMQ\Command;
4
5
use Portiny\RabbitMQ\BunnyManager;
6
use Symfony\Component\Console\Command\Command;
7
use Symfony\Component\Console\Input\InputInterface;
8
use Symfony\Component\Console\Output\OutputInterface;
9
10
final class DeclareCommand extends Command
11
{
12
13
	/**
14
	 * @var BunnyManager
15
	 */
16
	private $bunnyManager;
17
18
19
	public function __construct(BunnyManager $bunnyManager)
20
	{
21
		parent::__construct();
22
23
		$this->bunnyManager = $bunnyManager;
24
	}
25
26
27
	protected function configure(): void
28
	{
29
		$this->setName('rabbitmq:declare')
30
			->setDescription('Creates all exchanges and queues.');
31
	}
32
33
34
	protected function execute(InputInterface $input, OutputInterface $output): int
35
	{
36
		$output->write('<comment>Declaring...</comment>');
37
38
		$this->bunnyManager->declare();
39
40
		$output->writeln(' <info>DONE</info>');
41
42
		return 0;
43
	}
44
45
}
46