-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMessage.php
More file actions
81 lines (64 loc) · 1.48 KB
/
Message.php
File metadata and controls
81 lines (64 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<?php
namespace Utopia\Queue;
class Message
{
protected string $pid;
protected string $queue;
protected int $timestamp;
protected array $payload;
public function __construct(array $array = [])
{
if (empty($array)) {
return;
}
$this->pid = $array['pid'];
$this->queue = $array['queue'];
$this->timestamp = $array['timestamp'];
$this->payload = $array['payload'] ?? [];
}
public function setPid(string $pid): self
{
$this->pid = $pid;
return $this;
}
public function setQueue(string $queue): self
{
$this->queue = $queue;
return $this;
}
public function setTimestamp(int $timestamp): self
{
$this->timestamp = $timestamp;
return $this;
}
public function setPayload(array $payload): self
{
$this->payload = $payload;
return $this;
}
public function getPid(): string
{
return $this->pid;
}
public function getQueue(): string
{
return $this->queue;
}
public function getTimestamp(): int
{
return $this->timestamp;
}
public function getPayload(): array
{
return $this->payload;
}
public function asArray(): array
{
return [
'pid' => $this->pid,
'queue' => $this->queue,
'timestamp' => $this->timestamp,
'payload' => $this->payload ?? null,
];
}
}