Passed
Push — master ( 71d0aa...52238f )
by Andrés
04:41
created

HablameChannel   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 29
ccs 11
cts 11
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A send() 0 18 2
1
<?php
2
3
namespace Andreshg112\HablameSms;
4
5
use Illuminate\Notifications\Notification;
6
use Andreshg112\HablameSms\Exceptions\CouldNotSendNotification;
7
8
class HablameChannel
9
{
10
    /**
11
     * Send the given notification.
12
     *
13
     * @param mixed $notifiable
14
     * @param \Illuminate\Notifications\Notification $notification
15
     *
16
     * @throws \Andreshg112\HablameSms\Exceptions\CouldNotSendNotification
17
     */
18 2
    public function send($notifiable, Notification $notification)
19
    {
20
        /** @var \Andreshg112\HablameSms\HablameMessage $message */
21 2
        $message = $notification->toHablameNotification($notifiable);
0 ignored issues
show
Bug introduced by
The method toHablameNotification() does not seem to exist on object<Illuminate\Notifications\Notification>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
22
23 2
        $message = $message->toArray();
24
25 2
        $response = Facade::sendMessage(
26 2
            $message['numero'],
27 2
            $message['sms'],
28 2
            $message['fecha'],
29 2
            $message['referencia']
30
        );
31
32 2
        if ($response['resultado'] !== 0) {
33 1
            throw CouldNotSendNotification::serviceRespondedWithAnError($response);
34
        }
35 1
    }
36
}
37