| Total Complexity | 10 |
| Total Lines | 90 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 10 | trait RabbitTrait |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * @var string $queue |
||
| 14 | */ |
||
| 15 | private $queue; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * @var string $exchanger |
||
| 19 | */ |
||
| 20 | private $exchanger; |
||
| 21 | |||
| 22 | /** |
||
| 23 | * @var bool $reply |
||
| 24 | */ |
||
| 25 | private $reply; |
||
| 26 | |||
| 27 | /** |
||
| 28 | * @var string $queue |
||
| 29 | * @return self |
||
| 30 | */ |
||
| 31 | protected function setQueue(string $queue): self // Return yourself |
||
| 32 | { |
||
| 33 | $queue = trim($queue); |
||
| 34 | |||
| 35 | if (empty($queue)) { |
||
| 36 | throw new InternalNameException("Fila inválida!"); |
||
| 37 | } |
||
| 38 | |||
| 39 | if (!filter_var($queue)) { |
||
| 40 | throw new InternalNameException("Fila inválida!"); |
||
| 41 | } |
||
| 42 | |||
| 43 | $this->queue = $queue; |
||
| 44 | return $this; |
||
| 45 | } |
||
| 46 | |||
| 47 | /** |
||
| 48 | * @var string $queue |
||
| 49 | * @return self |
||
| 50 | */ |
||
| 51 | protected function setExchanger(string $exchanger): self // Return yourself |
||
| 52 | { |
||
| 53 | $exchanger = trim($exchanger); |
||
| 54 | |||
| 55 | if (empty($exchanger)) { |
||
| 56 | throw new InternalNameException("Exchanger '{$exchanger}' inválido!"); |
||
| 57 | } |
||
| 58 | |||
| 59 | if (!filter_var($exchanger)) { |
||
| 60 | throw new InternalNameException("Exchanger '{$exchanger}' inválido!"); |
||
| 61 | } |
||
| 62 | |||
| 63 | $this->exchanger = $exchanger; |
||
| 64 | return $this; |
||
| 65 | } |
||
| 66 | |||
| 67 | /** |
||
| 68 | * @var string $queue |
||
| 69 | * @return self |
||
| 70 | */ |
||
| 71 | protected function setReply(bool $reply): self // Return yourself |
||
| 72 | { |
||
| 73 | $this->reply = ($reply === true) ?? false; |
||
| 74 | |||
| 75 | return $this; |
||
| 76 | } |
||
| 77 | |||
| 78 | /** |
||
| 79 | * @return null|string |
||
| 80 | */ |
||
| 81 | public function getQueue(): string |
||
| 82 | { |
||
| 83 | return $this->queue; |
||
| 84 | } |
||
| 85 | |||
| 86 | /** |
||
| 87 | * @return null|string |
||
| 88 | */ |
||
| 89 | public function getExchanger(): string |
||
| 92 | } |
||
| 93 | |||
| 94 | /** |
||
| 95 | * @return null|bool |
||
| 96 | */ |
||
| 97 | public function getReply(): bool |
||
| 102 |