| Conditions | 4 |
| Paths | 5 |
| Total Lines | 21 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 12 |
| CRAP Score | 4 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 32 | 2 | public function send($notifiable, Notification $notification) |
|
| 33 | { |
||
| 34 | 2 | if (! $channel = $notifiable->routeNotificationFor('discord', $notification)) { |
|
| 35 | 1 | return; |
|
| 36 | } |
||
| 37 | |||
| 38 | 1 | $message = $notification->toDiscord($notifiable); |
|
| 39 | |||
| 40 | 1 | $data = [ |
|
| 41 | 1 | 'content' => $message->body |
|
| 42 | 1 | ]; |
|
| 43 | |||
| 44 | 1 | if (count($message->embed) > 0) { |
|
| 45 | 1 | $data['embeds'] = [$message->embed]; |
|
| 46 | } |
||
| 47 | |||
| 48 | 1 | if (count($message->components) > 0) { |
|
| 49 | 1 | $data['components'] = $message->components; |
|
| 50 | } |
||
| 51 | |||
| 52 | 1 | return $this->discord->send($channel, $data); |
|
| 53 | } |
||
| 55 |