Completed
Push — master ( d33fa5...7f909a )
by Freek
01:31
created

Notifiable::explodeArray()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 4
nc 2
nop 1
1
<?php
2
3
namespace Spatie\ServerMonitor\Notifications;
4
5
use Illuminate\Notifications\Notifiable as NotifiableTrait;
6
7
class Notifiable
8
{
9
    use NotifiableTrait;
10
11
    /** @var \Spatie\ServerMonitor\Events\Event */
12
    protected $event;
13
14
    public function routeNotificationForMail(): ?array
15
    {
16
        $mails = config('server-monitor.notifications.mail.to');
17
18
        if (is_string($mails)) {
19
            $mails = explode(',', $mails);
20
        }
21
22
        return $mails;
23
    }
24
25
    public function routeNotificationForSlack(): ?string
26
    {
27
        return config('server-monitor.notifications.slack.webhook_url');
28
    }
29
30
    public function getKey(): string
31
    {
32
        return static::class;
33
    }
34
35
    /**
36
     * Get the event for the notification.
37
     *
38
     * @return \Spatie\ServerMonitor\Events\Event
39
     */
40
    public function getEvent(): \Spatie\ServerMonitor\Events\Event
41
    {
42
        return $this->event;
43
    }
44
45
    /**
46
     * Set the event for the notification.
47
     *
48
     * @param \Spatie\ServerMonitor\Events\Event $event
49
     *
50
     * @return Notifiable
51
     */
52
    public function setEvent(\Spatie\ServerMonitor\Events\Event $event): Notifiable
53
    {
54
        $this->event = $event;
55
56
        return $this;
57
    }
58
}
59