Passed
Pull Request — master (#189)
by Dmitriy
02:39
created

Request   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 30
ccs 14
cts 14
cp 1
rs 10
c 0
b 0
f 0
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A withAdapter() 0 6 1
A __construct() 0 2 1
A getAdapter() 0 3 1
A getMessage() 0 3 1
A withMessage() 0 6 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Queue\Middleware;
6
7
use Yiisoft\Queue\Adapter\AdapterInterface;
8
use Yiisoft\Queue\Message\MessageInterface;
9
10
final class Request
11
{
12 44
    public function __construct(private MessageInterface $message, private ?AdapterInterface $adapter)
13
    {
14 44
    }
15
16 38
    public function getMessage(): MessageInterface
17
    {
18 38
        return $this->message;
19
    }
20
21 11
    public function getAdapter(): ?AdapterInterface
22
    {
23 11
        return $this->adapter;
24
    }
25
26 31
    public function withMessage(MessageInterface $message): self
27
    {
28 31
        $instance = clone $this;
29 31
        $instance->message = $message;
30
31 31
        return $instance;
32
    }
33
34 5
    public function withAdapter(AdapterInterface $adapter): self
35
    {
36 5
        $instance = clone $this;
37 5
        $instance->adapter = $adapter;
38
39 5
        return $instance;
40
    }
41
}
42