| Total Complexity | 9 |
| Total Lines | 72 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 11 | final class Binding |
||
| 12 | { |
||
| 13 | private $exchange; |
||
| 14 | private $queue; |
||
| 15 | private $routingKey; |
||
| 16 | private $wait = true; |
||
| 17 | private $arguments; |
||
| 18 | |||
| 19 | 52 | public function __construct(string $exchange, string $queue, string $routingKey = '') |
|
| 20 | { |
||
| 21 | 52 | $this->exchange = $exchange; |
|
| 22 | 52 | $this->queue = $queue; |
|
| 23 | 52 | $this->routingKey = $routingKey; |
|
| 24 | 52 | $this->arguments = new Map('string', 'mixed'); |
|
| 25 | 52 | } |
|
| 26 | |||
| 27 | /** |
||
| 28 | * Don't wait for the server response |
||
| 29 | */ |
||
| 30 | 6 | public function dontWait(): self |
|
| 31 | { |
||
| 32 | 6 | $self = clone $this; |
|
| 33 | 6 | $self->wait = false; |
|
| 34 | |||
| 35 | 6 | return $self; |
|
| 36 | } |
||
| 37 | |||
| 38 | /** |
||
| 39 | * Wait for the response server |
||
| 40 | */ |
||
| 41 | 2 | public function wait(): self |
|
| 42 | { |
||
| 43 | 2 | $self = clone $this; |
|
| 44 | 2 | $self->wait = true; |
|
| 45 | |||
| 46 | 2 | return $self; |
|
| 47 | } |
||
| 48 | |||
| 49 | 4 | public function withArgument(string $key, $value): self |
|
| 50 | { |
||
| 51 | 4 | $self = clone $this; |
|
| 52 | 4 | $self->arguments = $self->arguments->put($key, $value); |
|
| 53 | |||
| 54 | 4 | return $self; |
|
| 55 | } |
||
| 56 | |||
| 57 | 40 | public function exchange(): string |
|
| 58 | { |
||
| 59 | 40 | return $this->exchange; |
|
| 60 | } |
||
| 61 | |||
| 62 | 40 | public function queue(): string |
|
| 65 | } |
||
| 66 | |||
| 67 | 40 | public function routingKey(): string |
|
| 68 | { |
||
| 69 | 40 | return $this->routingKey; |
|
| 70 | } |
||
| 71 | |||
| 72 | 44 | public function shouldWait(): bool |
|
| 73 | { |
||
| 74 | 44 | return $this->wait; |
|
| 75 | } |
||
| 76 | |||
| 77 | /** |
||
| 78 | * @return MapInterface<string, mixed> |
||
| 79 | */ |
||
| 80 | 42 | public function arguments(): MapInterface |
|
| 83 | } |
||
| 84 | } |
||
| 85 |