Completed
Push — master ( ace356...baaf26 )
by Hilmi Erdem
01:59
created

JetSmsChannel   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 0
cbo 2
dl 0
loc 23
ccs 7
cts 7
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A send() 0 12 2
1
<?php
2
3
namespace NotificationChannels\JetSms;
4
5
use Illuminate\Notifications\Notification;
6
use NotificationChannels\JetSms\Exceptions\CouldNotSendNotification;
7
8
/**
9
 * Class JetSmsChannel.
10
 */
11
final class JetSmsChannel
12
{
13
    /**
14
     * Send the given notification.
15
     *
16
     * @param  mixed                                  $notifiable
17
     * @param  \Illuminate\Notifications\Notification $notification
18
     * @throws \NotificationChannels\JetSms\Exceptions\CouldNotSendNotification
19
     * @return void
20
     */
21 2
    public function send($notifiable, Notification $notification)
22
    {
23 2
        $to = $notifiable->routeNotificationFor('JetSms');
24
25 2
        if (empty($to)) {
26 1
            throw CouldNotSendNotification::missingRecipient();
27
        }
28
29 1
        $message = $notification->toJetSms($notifiable);
30
31 1
        JetSms::sendShortMessage($to, $message);
32 1
    }
33
}
34