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   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 27
rs 10
c 0
b 0
f 0
wmc 3
lcom 1
cbo 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 20 3
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