Passed
Push — master ( 055b76...bacc0b )
by Patrick
01:33 queued 12s
created

MessageDto   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 68
Duplicated Lines 0 %

Test Coverage

Coverage 7.69%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 17
c 1
b 0
f 1
dl 0
loc 68
ccs 2
cts 26
cp 0.0769
rs 10
wmc 9

9 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 10 1
A setId() 0 5 1
A setDatacontenttype() 0 5 1
A setData() 0 5 1
A setAdapterMetaResponse() 0 5 1
A setType() 0 5 1
A setQueueName() 0 5 1
A setSpecversion() 0 5 1
A setTime() 0 5 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of forecast.it.fill project.
7
 * (c) Patrick Jaja <[email protected]>
8
 * This source file is subject to the MIT license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
namespace ForecastAutomation\QueueClient\Shared\Dto;
13
14
use ForecastAutomation\Kernel\Shared\Dto\AbstractDto;
15
16
// https://github.com/cloudevents/spec/blob/v1.0.1/json-format.md#32-examples
17
// https://docs.dapr.io/developing-applications/building-blocks/pubsub/pubsub-overview/
18
class MessageDto extends AbstractDto
19
{
20 1
    public function __construct(
21
        public array $data = [],
22
        public string $queueName = 'queueName',
23
        public string $type = 'eventName',
24
        public string $specversion = '1.0',
25
        public string $datacontenttype = 'application/json',
26
        public string $id = '',
27
        public int $time = 0,
28
        public array $adapterMetaResponse = [],
29
    ) {
30 1
    }
31
32
    public function setData(array $data): self
33
    {
34
        $this->data = $data;
35
36
        return $this;
37
    }
38
39
    public function setQueueName(string $queueName): self
40
    {
41
        $this->queueName = $queueName;
42
43
        return $this;
44
    }
45
46
    public function setType(string $type): self
47
    {
48
        $this->type = $type;
49
50
        return $this;
51
    }
52
53
    public function setSpecversion(string $specversion): self
54
    {
55
        $this->specversion = $specversion;
56
57
        return $this;
58
    }
59
60
    public function setDatacontenttype(string $datacontenttype): self
61
    {
62
        $this->datacontenttype = $datacontenttype;
63
64
        return $this;
65
    }
66
67
    public function setId(string $id): self
68
    {
69
        $this->id = $id;
70
71
        return $this;
72
    }
73
74
    public function setTime(int $time): self
75
    {
76
        $this->time = $time;
77
78
        return $this;
79
    }
80
81
    public function setAdapterMetaResponse(array $adapterMetaResponse): self
82
    {
83
        $this->adapterMetaResponse = $adapterMetaResponse;
84
85
        return $this;
86
    }
87
}
88