GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

BaseNotification::toEngageSpark()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace LBHurtado\EngageSpark\Notifications;
4
5
use Illuminate\Bus\Queueable;
6
use Illuminate\Notifications\Notification;
7
use LBHurtado\EngageSpark\EngageSparkMessage;
8
9
abstract class BaseNotification extends Notification
10
{
11
    use Queueable;
12
13
    /** @var int  */
14
    protected $amount = 0;
15
16
    /** @var string */
17
    protected $message;
18
19
    public function __construct($message = null)
20
    {
21
        $this->message = $message;
22
    }
23
24
    public function setMessage($message)
25
    {
26
        $this->message = $message;
27
28
        return $this;
29
    }
30
31
    public function setAmount($amount)
32
    {
33
        $this->amount = $amount;
34
35
        return $this;
36
    }
37
38
    public function via($notifiable)
0 ignored issues
show
Unused Code introduced by
The parameter $notifiable is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
39
    {
40
        return config('engagespark.notification.channels');
41
    }
42
43
    public function toArray($notifiable)
44
    {
45
        return [
46
            'mobile' => $notifiable->mobile,
47
            'content' => $this->getContent($notifiable),
48
            'mode' => $this->getMode($notifiable)
49
        ];
50
    }
51
52
    public function toEngageSpark($notifiable)
53
    {
54
        return (new EngageSparkMessage())
55
            ->content($this->getContent($notifiable))
56
            ->mode($this->getMode($notifiable))
57
            ->transfer($this->getAmount($notifiable))
58
            ;
59
    }
60
61
    public function getContent($notifiable)
0 ignored issues
show
Unused Code introduced by
The parameter $notifiable is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
62
    {
63
        return $this->amount > 0 ? $this->amount : $this->message;
64
    }
65
66
    protected function getMode($notifiable)
0 ignored issues
show
Unused Code introduced by
The parameter $notifiable is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
67
    {
68
        return $this->amount > 0 ? 'topup' : 'sms';
69
    }
70
71
    protected function getAmount($notifiable)
0 ignored issues
show
Unused Code introduced by
The parameter $notifiable is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
72
    {
73
        return $this->amount;
74
    }
75
}
76