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 ( 0dd6ad...c9c67c )
by Freek
02:02
created

SiteUp::isStillRelevant()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 4
rs 10
1
<?php
2
3
namespace Spatie\UptimeMonitor\Notifications\Notifications;
4
5
use Illuminate\Notifications\Messages\MailMessage;
6
use Illuminate\Notifications\Messages\SlackAttachment;
7
use Illuminate\Notifications\Messages\SlackMessage;
8
use Spatie\UptimeMonitor\Events\SiteUp as SiteUpEvent;
9
use Spatie\UptimeMonitor\Models\Enums\UptimeStatus;
10
use Spatie\UptimeMonitor\Notifications\BaseNotification;
11
12 View Code Duplication
class SiteUp extends BaseNotification
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
13
{
14
    /** @var \Spatie\UptimeMonitor\Events\SiteDown */
15
    protected $event;
16
17
    /**
18
     * Get the mail representation of the notification.
19
     *
20
     * @param  mixed $notifiable
21
     * @return \Illuminate\Notifications\Messages\MailMessage
22
     */
23
    public function toMail($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...
24
    {
25
        $mailMessage = (new MailMessage)
26
            ->success()
27
            ->subject("Site {$this->event->site->url} is up.")
28
            ->line('Site is up');
29
30
        return $mailMessage;
31
    }
32
33
    public function toSlack($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...
34
    {
35
        return (new SlackMessage)
36
            ->success()
37
            ->content("Site {$this->event->site->url} is up")
38
            ->attachment(function (SlackAttachment $attachment) {
39
                $attachment->fields($this->getSiteProperties());
0 ignored issues
show
Bug introduced by
The call to getSiteProperties() misses a required argument $extraProperties.

This check looks for function calls that miss required arguments.

Loading history...
40
            });
41
    }
42
43
    public function setEvent(SiteUpEvent $event)
44
    {
45
        $this->event = $event;
0 ignored issues
show
Documentation Bug introduced by
It seems like $event of type object<Spatie\UptimeMonitor\Events\SiteUp> is incompatible with the declared type object<Spatie\UptimeMonitor\Events\SiteDown> of property $event.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
46
47
        return $this;
48
    }
49
}
50