Total Complexity | 7 |
Total Lines | 49 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
6 | final class Close |
||
7 | { |
||
8 | private $replyCode; |
||
9 | private $replyText; |
||
10 | private $cause; |
||
11 | |||
12 | 4 | public static function reply(int $code, string $text): self |
|
13 | { |
||
14 | 4 | $self = new self; |
|
15 | 4 | $self->replyCode = $code; |
|
16 | 4 | $self->replyText = $text; |
|
17 | |||
18 | 4 | return $self; |
|
19 | } |
||
20 | |||
21 | /** |
||
22 | * @param string $method ie: exchange.declare, channel.open, etc |
||
23 | */ |
||
24 | 4 | public function causedBy(string $method): self |
|
25 | { |
||
26 | 4 | $self = clone $this; |
|
27 | 4 | $self->cause = $method; |
|
28 | |||
29 | 4 | return $self; |
|
30 | } |
||
31 | |||
32 | 80 | public function hasReply(): bool |
|
35 | } |
||
36 | |||
37 | 4 | public function replyCode(): int |
|
40 | } |
||
41 | |||
42 | 4 | public function replyText(): string |
|
45 | } |
||
46 | |||
47 | 82 | public function causedKnown(): bool |
|
48 | { |
||
49 | 82 | return \is_string($this->cause); |
|
50 | } |
||
51 | |||
52 | 4 | public function cause(): string |
|
55 | } |
||
56 | } |
||
57 |