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

Message   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getMetadata() 0 3 1
A getData() 0 3 1
A getHandler() 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 mixed $data Message data, encodable by a queue adapter
11
     * @param array $metadata Message metadata, encodable by a queue adapter
12
     * @param string|null $id Message id
13
     */
14 74
    public function __construct(
15
        private string $handlerName,
16
        private mixed $data,
17
        private array $metadata = [],
18
    ) {
19 74
    }
20
21 22
    public function getHandler(): string
22
    {
23 22
        return $this->handlerName;
24
    }
25
26 37
    public function getData(): mixed
27
    {
28 37
        return $this->data;
29
    }
30
31 29
    public function getMetadata(): array
32
    {
33 29
        return $this->metadata;
34
    }
35
}
36