-
-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathQueue.php
More file actions
160 lines (128 loc) · 3.36 KB
/
Copy pathQueue.php
File metadata and controls
160 lines (128 loc) · 3.36 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
<?php
declare(strict_types=1);
namespace Yiisoft\Queue\AMQP\Settings;
use PhpAmqpLib\Wire\AMQPTable;
use Yiisoft\Queue\Provider\QueueProviderInterface;
final class Queue implements QueueSettingsInterface
{
public function __construct(
private string $queueName = QueueProviderInterface::DEFAULT_QUEUE,
private bool $passive = false,
private bool $durable = true,
private bool $exclusive = false,
private bool $autoDelete = false,
private bool $nowait = false,
private AMQPTable|array $arguments = [],
private ?int $ticket = null,
private ?QosSettings $qosSettings = null,
) {
}
public function getArguments(): AMQPTable|array
{
return $this->arguments;
}
public function getName(): string
{
return $this->queueName;
}
public function getTicket(): ?int
{
return $this->ticket;
}
public function isAutoDeletable(): bool
{
return $this->autoDelete;
}
public function isDurable(): bool
{
return $this->durable;
}
public function isExclusive(): bool
{
return $this->exclusive;
}
public function hasNowait(): bool
{
return $this->nowait;
}
public function isPassive(): bool
{
return $this->passive;
}
public function getQosSettings(): ?QosSettings
{
return $this->qosSettings;
}
/**
* @psalm-return array{0: string, 1: bool, 2: bool, 3: bool, 4: bool, 5: bool, 6: AMQPTable|array, 7: int|null}
*
* @psalm-suppress LessSpecificImplementedReturnType Can be removed after raise Psalm version to ^5.0
*/
public function getPositionalSettings(): array
{
return [
$this->queueName,
$this->passive,
$this->durable,
$this->exclusive,
$this->autoDelete,
$this->nowait,
$this->arguments,
$this->ticket,
];
}
public function withName(string $name): self
{
$instance = clone $this;
$instance->queueName = $name;
return $instance;
}
public function withArguments(AMQPTable|array $arguments): self
{
$new = clone $this;
$new->arguments = $arguments;
return $new;
}
public function withTicket(?int $ticket): self
{
$new = clone $this;
$new->ticket = $ticket;
return $new;
}
public function withAutoDeletable(bool $autoDeletable): self
{
$new = clone $this;
$new->autoDelete = $autoDeletable;
return $new;
}
public function withDurable(bool $durable): self
{
$new = clone $this;
$new->durable = $durable;
return $new;
}
public function withExclusive(bool $exclusive): self
{
$new = clone $this;
$new->exclusive = $exclusive;
return $new;
}
public function withNowait(bool $nowait): self
{
$new = clone $this;
$new->nowait = $nowait;
return $new;
}
public function withPassive(bool $passive): self
{
$new = clone $this;
$new->passive = $passive;
return $new;
}
public function withQosSettings(?QosSettings $qosSettings): self
{
$new = clone $this;
$new->qosSettings = $qosSettings;
return $new;
}
}