Passed
Pull Request — master (#182)
by Dmitriy
03:25 queued 46s
created

EnvelopeTrait   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Test Coverage

Coverage 33.33%

Importance

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

5 Methods

Rating   Name   Duplication   Size   Complexity  
A withMessage() 0 6 1
A getMessage() 0 3 1
A getData() 0 3 1
A getHandler() 0 3 1
A getMetadata() 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
    /**
25
     * @return class-string<MessageHandlerInterface>
0 ignored issues
show
Documentation Bug introduced by
The doc comment class-string<MessageHandlerInterface> at position 0 could not be parsed: Unknown type name 'class-string' at position 0 in class-string<MessageHandlerInterface>.
Loading history...
26
     */
27 7
    public function getHandler(): string
28
    {
29 7
        return $this->message->getHandler();
30
    }
31
32 1
    public function getData(): mixed
33
    {
34 1
        return $this->message->getData();
35
    }
36
37
    public function getMetadata(): array
38
    {
39
        return $this->message->getMetadata();
40
    }
41
}
42