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

Message   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 4
c 1
b 0
f 0
dl 0
loc 28
ccs 8
cts 8
cp 1
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getMetadata() 0 3 1
A getHandler() 0 3 1
A getData() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Queue\Message;
6
7
final class Message implements MessageInterface
8
{
9
    /**
10
     * @param class-string<MessageHandlerInterface> $handler Message handler class name
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...
11
     * @param mixed $data Message data, encodable by a queue adapter
12
     * @param array $metadata Message metadata, encodable by a queue adapter
13
     * @param string|null $id Message id
14
     */
15 74
    public function __construct(
16
        private string $handler,
17
        private mixed $data,
18
        private array $metadata = [],
19
    ) {
20 74
    }
21
22 22
    public function getHandler(): string
23
    {
24 22
        return $this->handler;
25
    }
26
27 37
    public function getData(): mixed
28
    {
29 37
        return $this->data;
30
    }
31
32 29
    public function getMetadata(): array
33
    {
34 29
        return $this->metadata;
35
    }
36
}
37