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

EnvelopeTrait::getHandler()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
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