SmsirChannel   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 3
eloc 5
c 1
b 0
f 1
dl 0
loc 26
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 2 1
A send() 0 10 2
1
<?php
2
3
namespace Rezahmady\Smsir;
4
5
use Rezahmady\Smsir\Exceptions\CouldNotSendNotification;
6
use Illuminate\Notifications\Notification;
7
use Illuminate\Support\Facades\Log;
8
use Rezahmady\Smsir\Facades\Smsir;
9
10
class SmsirChannel
11
{
12
13
    public function __construct()
14
    {
15
        // Initialisation code here
16
    }
17
18
    /**
19
     * Send the given notification.
20
     *
21
     * @param mixed $notifiable
22
     * @param \Illuminate\Notifications\Notification $notification
23
     *
24
     * @throws \Rezahmady\Smsir\Exceptions\CouldNotSendNotification
25
     */
26
    public function send($notifiable, Notification $notification)
27
    {
28
29
        if(! $to = $notifiable->routeNotificationFor('smsir')) {
30
            return;
31
        }
32
        
33
        $message = $notification->toSmsir($notifiable);
0 ignored issues
show
Bug introduced by
The method toSmsir() does not exist on Illuminate\Notifications\Notification. ( Ignorable by Annotation )

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

33
        /** @scrutinizer ignore-call */ 
34
        $message = $notification->toSmsir($notifiable);

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...
34
35
        return $message->setTo($to)->trigger();
36
    }
37
}
38