| Conditions | 3 |
| Paths | 4 |
| Total Lines | 18 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 3.0327 |
| Changes | 0 | ||
| 1 | <?php |
||
| 33 | 1 | protected function doSend(Notification $notification): void |
|
| 34 | { |
||
| 35 | /** @var SlackChannelDestination $destination */ |
||
| 36 | 1 | $destination = $notification->destination(); |
|
| 37 | 1 | $text = $notification->subject()->subject()."\n\n"; |
|
| 38 | 1 | $text .= $notification->body()->body(); |
|
| 39 | 1 | $message = new Message($this->client); |
|
| 40 | 1 | $message->setAllowMarkdown(true); |
|
| 41 | 1 | $message->setText($text); |
|
| 42 | 1 | if ($destination instanceof SlackChannelDestination) { |
|
| 43 | 1 | $message->setChannel($destination->channel()); |
|
| 44 | } |
||
| 45 | try { |
||
| 46 | 1 | $message->send(); |
|
| 47 | } catch (Throwable $e) { |
||
|
1 ignored issue
–
show
|
|||
| 48 | throw new NotificationNotSentException($notification, $e); |
||
| 49 | } |
||
| 50 | 1 | } |
|
| 51 | |||
| 60 |