Test Failed
Pull Request — master (#2)
by Talha Zekeriya
19:57 queued 09:46
created

NetGsmChannel::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
namespace NotificationChannels\NetGsm;
4
5
use Illuminate\Notifications\Notification;
6
7
class NetGsmChannel
8
{
9
    /** @var \NotificationChannels\NetGsm\NetGsmClient */
10
    protected $client;
11
12
    /**
13
     * NetGsmChannel constructor.
14
     * @param  NetGsmClient  $client
15
     */
16
    public function __construct(NetGsmClient $client)
17
    {
18
        $this->client = $client;
19
    }
20
21
    /**
22
     * Send the given notification.
23
     *
24
     * @param  mixed  $notifiable
25
     * @param  \Illuminate\Notifications\Notification  $notification
26
     *
27
     * @throws \NotificationChannels\NetGsm\Exceptions\CouldNotSendNotification
28
     */
29
    public function send($notifiable, Notification $notification)
30
    {
31
        $message = $notification->toNetGsm($notifiable);
0 ignored issues
show
introduced by
The method toNetGsm() does not exist on Illuminate\Notifications\Notification. Are you sure you never get this type here, but always one of the subclasses? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

31
        /** @scrutinizer ignore-call */ 
32
        $message = $notification->toNetGsm($notifiable);
Loading history...
32
33
        if (is_string($message)) {
34
            $message = NetGsmMessage::create($message);
35
        }
36
37
        if ($to = $notifiable->routeNotificationFor('netgsm')) {
38
            $message->setRecipients($to);
39
        }
40
41
        $this->client->send($message);
42
    }
43
}
44