ExchangeDeclaredException   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 16
dl 0
loc 12
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getName() 0 3 1
A getSolution() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Queue\AMQP\Exception;
6
7
use InvalidArgumentException;
8
use Yiisoft\FriendlyException\FriendlyExceptionInterface;
9
10
class ExchangeDeclaredException extends InvalidArgumentException implements FriendlyExceptionInterface
11
{
12
    protected $message = 'Can\'t set channel name implicitly when an exchange is declared';
13
14
    public function getName(): string
15
    {
16
        return 'Exchange is declared';
17
    }
18
19
    public function getSolution(): ?string
20
    {
21
        return <<<'SOLUTION'
22
            Can't explicitly set channel name when an exchange is declared.
23
24
            Probably, you have called QueueFactory::get() without explicit configuration
25
            for a given channel.
26
            Your QueueProvider configuration has an exchange,
27
            which can't be implicitly binded to a new queue due to differences in behaviors
28
            of different types of exchanges. Please, create an explicit configuration
29
            with a fully-configured adapter for the channel you are trying to create.
30
31
            Reference: https://github.com/yiisoft/yii-queue#different-queue-channels
32
33
            SOLUTION;
34
    }
35
}
36