DeclareCommand   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 4
Bugs 2 Features 1
Metric Value
wmc 3
eloc 13
c 4
b 2
f 1
dl 0
loc 37
ccs 0
cts 13
cp 0
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A execute() 0 9 1
A configure() 0 4 1
1
<?php declare(strict_types = 1);
2
3
namespace Portiny\RabbitMQ\Command;
4
5
use Portiny\RabbitMQ\BunnyManager;
6
use Symfony\Component\Console\Attribute\AsCommand;
0 ignored issues
show
Bug introduced by
The type Symfony\Component\Console\Attribute\AsCommand was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
7
use Symfony\Component\Console\Command\Command;
8
use Symfony\Component\Console\Input\InputInterface;
9
use Symfony\Component\Console\Output\OutputInterface;
10
11
#[AsCommand(
12
	name: 'rabbitmq:declare',
13
	description: 'Creates all exchanges and queues.'
14
)]
15
final class DeclareCommand extends Command
16
{
17
18
	/**
19
	 * @var BunnyManager
20
	 */
21
	private $bunnyManager;
22
23
24
	public function __construct(BunnyManager $bunnyManager)
25
	{
26
		parent::__construct();
27
28
		$this->bunnyManager = $bunnyManager;
29
	}
30
31
32
	protected function configure(): void
33
	{
34
		$this->setName('rabbitmq:declare')
35
			->setDescription('Creates all exchanges and queues.');
36
	}
37
38
39
	protected function execute(InputInterface $input, OutputInterface $output): int
40
	{
41
		$output->write('<comment>Declaring...</comment>');
42
43
		$this->bunnyManager->declare();
44
45
		$output->writeln(' <info>DONE</info>');
46
47
		return 0;
48
	}
49
50
}
51