Passed
Pull Request — master (#190)
by Dmitriy
03:56
created

MessageTrait::getMetadata()   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 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Queue\Message;
6
7
trait MessageTrait
8
{
9
    private mixed $data = [];
10
    private array $metadata = [];
11
12 53
    public function getData(): mixed
13
    {
14 53
        return $this->data;
15
    }
16
17 8
    public function withData(mixed $data): self
18
    {
19 8
        $new = clone $this;
20 8
        $new->data = $data;
21 8
        return $new;
22
    }
23
24 38
    public function getMetadata(): array
25
    {
26 38
        return $this->metadata;
27
    }
28
29 5
    public function withMetadata(array $metadata): self
30
    {
31 5
        $new = clone $this;
32 5
        $new->metadata = $metadata;
33 5
        return $new;
34
    }
35
}
36