ChannelNotConfiguredException   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 23
ccs 11
cts 11
cp 1
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getSolution() 0 7 1
A getName() 0 3 1
A __construct() 0 5 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Queue\Exception\AdapterConfiguration;
6
7
use InvalidArgumentException;
8
use Throwable;
9
use Yiisoft\FriendlyException\FriendlyExceptionInterface;
10
use Yiisoft\Queue\QueueFactory;
11
12
class ChannelNotConfiguredException extends InvalidArgumentException implements FriendlyExceptionInterface
13
{
14
    private string $channel;
15
16 1
    public function __construct(string $channel, int $code = 0, Throwable $previous = null)
17
    {
18 1
        $message = "Queue channel \"$channel\" is not properly configured.";
19 1
        $this->channel = $channel;
20 1
        parent::__construct($message, $code, $previous);
21
    }
22
23 1
    public function getName(): string
24
    {
25 1
        return 'Queue channel is not properly configured';
26
    }
27
28 1
    public function getSolution(): ?string
29
    {
30 1
        $factoryClass = QueueFactory::class;
31
32 1
        return <<<SOLUTION
33 1
            Channel "$this->channel" creation is not configured in the $factoryClass.
34 1
            Please take a look to the documentation for the $factoryClass constructor.
35
            The most important parameters are "\$definitions" and "\$enableRuntimeChannelDefinition".
36
37 1
            SOLUTION;
38
    }
39
}
40