Passed
Pull Request — master (#182)
by Dmitriy
02:37
created

EnvelopeTrait   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Test Coverage

Coverage 33.33%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
c 1
b 0
f 0
dl 0
loc 30
ccs 4
cts 12
cp 0.3333
rs 10
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A withMessage() 0 6 1
A getData() 0 3 1
A getMessage() 0 3 1
A getMetadata() 0 3 1
A getHandler() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Queue\Message;
6
7
trait EnvelopeTrait
8
{
9
    private MessageInterface $message;
10
11
    public function getMessage(): MessageInterface
12
    {
13
        return $this->message;
14
    }
15
16
    public function withMessage(MessageInterface $message): self
17
    {
18
        $instance = clone $this;
19
        $instance->message = $message;
20
21
        return $instance;
22
    }
23
24 7
    public function getHandler(): string
25
    {
26 7
        return $this->message->getHandler();
27
    }
28
29 1
    public function getData(): mixed
30
    {
31 1
        return $this->message->getData();
32
    }
33
34
    public function getMetadata(): array
35
    {
36
        return $this->message->getMetadata();
37
    }
38
}
39