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 ( 2e6529...409123 )
by Freek
01:48
created

DeleteSite::handle()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 20
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 10
nc 3
nop 0
dl 0
loc 20
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace Spatie\UptimeMonitor\Commands;
4
5
use Illuminate\Console\Command;
6
use Spatie\UptimeMonitor\Models\Site;
7
8
class DeleteSite extends Command
9
{
10
    protected $signature = 'sites:delete';
11
12
    protected $description = 'Stop monitoring a site';
13
14
    public function handle()
15
    {
16
        $this->warn("Let's create your new uptime monitor!");
17
18
        $url = $this->ask('Specify the url of the uptime monitor that should be deleted');
19
20
        $site = Site::where('url', $url)->first();
21
22
        if (! $site) {
23
            $this->error("There is no uptime monitor for url {$url}");
24
25
            return;
26
        }
27
28
        if ($this->confirm("Are you sure you want to delete the uptime monitor for {$site->url}?")) {
29
            $site->delete();
30
31
            $this->warn("Uptime monitor {$url} deleted!");
32
        }
33
    }
34
}
35