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::getMonitor()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Spatie\UptimeMonitor\Notifications;
4
5
use Illuminate\Notifications\Notification;
6
use Spatie\UptimeMonitor\Models\Enums\CertificateStatus;
7
use Spatie\UptimeMonitor\Models\Monitor;
8
9
abstract class BaseNotification extends Notification
10
{
11
    /**
12
     * Get the notification's delivery channels.
13
     *
14
     * @param  mixed $notifiable
15
     * @return array
16
     */
17
    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...
18
    {
19
        return config('uptime-monitor.notifications.notifications.'.static::class);
20
    }
21
22
    public function getMonitor(): Monitor
23
    {
24
        return $this->event->monitor;
0 ignored issues
show
Bug introduced by
The property event does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
25
    }
26
27
    public function getMonitorProperties($extraProperties = []): array
28
    {
29
        $monitor = $this->getMonitor();
30
31
        $properties = array_merge([], $extraProperties);
32
33
        if ($monitor->certificate_check_enabled && $monitor->certificate_status === CertificateStatus::VALID) {
34
            $certificateTitle = "Certificate expires in {$monitor->formattedCertificateExpirationDate('forHumans')}";
35
            $certificateIssuer = $monitor->certificate_issuer;
36
37
            $properties[$certificateTitle] = $certificateIssuer;
38
        }
39
40
        return array_filter($properties);
41
    }
42
43
    public function getLocationDescription(): string
44
    {
45
        $configuredLocation = config('uptime-monitor.notifications.location');
46
47
        if ($configuredLocation == '') {
48
            return '';
49
        }
50
51
        return "Monitor {$configuredLocation}";
52
    }
53
54
    public function isStillRelevant(): bool
55
    {
56
        return true;
57
    }
58
}
59