AdapterNotConfiguredException   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 16
dl 0
loc 24
ccs 10
cts 10
cp 1
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getSolution() 0 15 1
A getName() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Queue\Exception\AdapterConfiguration;
6
7
use RuntimeException;
8
use Yiisoft\FriendlyException\FriendlyExceptionInterface;
9
use Yiisoft\Queue\Queue;
10
use Yiisoft\Queue\QueueFactory;
11
12
class AdapterNotConfiguredException extends RuntimeException implements FriendlyExceptionInterface
13
{
14
    protected $message = 'Queue adapter is not configured';
15
16 2
    public function getName(): string
17
    {
18 2
        return 'Adapter is not configured';
19
    }
20
21 2
    public function getSolution(): ?string
22
    {
23 2
        $queueClass = Queue::class;
24 2
        $factoryClass = QueueFactory::class;
25
26 2
        return <<<SOLUTION
27 2
            Adapter property must be set in the Queue object before you can use it.
28
            Please use either a constructor "\$adapter" parameter, or "withAdapter()" queue method
29
            to set an appropriate adapter.
30
            A more convenient way to get a configured Queue is a QueueFactory usage.
31
32
            References:
33 2
            - $queueClass::\$adapter
34 2
            - $queueClass::withAdapter()
35 2
            - $factoryClass::get()
36 2
            SOLUTION;
37
    }
38
}
39