| 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 | 82 | public function hasReply(): bool |
|
| 33 | { |
||
| 34 | 82 | return \is_int($this->replyCode); |
|
| 35 | } |
||
| 36 | |||
| 37 | 4 | public function replyCode(): int |
|
| 38 | { |
||
| 39 | 4 | return $this->replyCode; |
|
| 40 | } |
||
| 41 | |||
| 42 | 4 | public function replyText(): string |
|
| 43 | { |
||
| 44 | 4 | return $this->replyText; |
|
| 45 | } |
||
| 46 | |||
| 47 | 84 | public function causedKnown(): bool |
|
| 50 | } |
||
| 51 | |||
| 52 | 4 | public function cause(): string |
|
| 55 | } |
||
| 56 | } |
||
| 57 |