HablameChannel   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 4
Bugs 1 Features 0
Metric Value
wmc 2
eloc 10
c 4
b 1
f 0
dl 0
loc 23
ccs 6
cts 6
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A send() 0 15 2
1
<?php
2
3
namespace Andreshg112\HablameSms;
4
5
use Andreshg112\HablameSms\Exceptions\CouldNotSendNotification;
6
7
class HablameChannel
8
{
9
    /**
10
     * Send the given notification.
11
     *
12
     * @param  \Illuminate\Notifications\Notifiable  $notifiable
13
     * @throws \Andreshg112\HablameSms\Exceptions\CouldNotSendNotification
14
     */
15
    public function send($notifiable, HablameNotification $notification)
16
    {
17
        $message = $notification->toHablameNotification($notifiable);
18 4
19
        /** @var \Andreshg112\HablameSms\HablameMessage $message */
20
        $messageArray = $message->toArray();
21
22
        try {
23 4
            Facade::sendMessage(
24
                $messageArray['phoneNumbers'],
25 4
                $messageArray['sms'],
26
                $messageArray['sendDate']
27 4
            );
28 4
        } catch (\Throwable $th) {
29 4
            throw new CouldNotSendNotification($th->getMessage(), $th->getCode(), $th);
30 4
        }
31 4
    }
32
}
33