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.
Completed
Push — master ( 97e8d1...15f2c9 )
by Cody
02:35
created

DiscordChannel::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
crap 2
1
<?php
2
3
namespace NotificationChannels\Discord;
4
5
use Illuminate\Notifications\Notification;
6
7
class DiscordChannel
8
{
9
    /**
10
     * @var \NotificationChannels\Discord\Discord
11
     */
12
    protected $discord;
13
14
    /**
15
     * @param \NotificationChannels\Discord\Discord $discord
16
     */
17
    public function __construct(Discord $discord)
18
    {
19
        $this->discord = $discord;
20
    }
21
22
    /**
23
     * Send the given notification.
24
     *
25
     * @param mixed $notifiable
26
     * @param \Illuminate\Notifications\Notification $notification
27
     *
28
     * @return void
29
     *
30
     * @throws \NotificationChannels\Discord\Exceptions\CouldNotSendNotification
31
     */
32
    public function send($notifiable, Notification $notification)
33
    {
34
        if (! $channel = $notifiable->routeNotificationFor('discord')) {
35
            return;
36
        }
37
38
        $message = $notification->toDiscord($notifiable);
39
40
        $this->discord->send($channel, [
41
            'content' => $message->body,
42
            'embed' => $message->embed,
43
        ]);
44
    }
45
}
46