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 ( f14d00...b85ce8 )
by Freek
04:11 queued 01:55
created

DeleteMonitor   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 18 3
1
<?php
2
3
namespace Spatie\UptimeMonitor\Commands;
4
5
use Spatie\UptimeMonitor\Models\Monitor;
6
7
class DeleteMonitor extends BaseCommand
8
{
9
    protected $signature = 'monitor:delete {url}';
10
11
    protected $description = 'Stop monitoring a site by deleting it from the database';
12
13
    public function handle()
14
    {@
0 ignored issues
show
Security Best Practice introduced by
It seems like you do not handle an error condition here. This can introduce security issues, and is generally not recommended.

If you suppress an error, we recommend checking for the error condition explicitly:

// For example instead of
@mkdir($dir);

// Better use
if (@mkdir($dir) === false) {
    throw new \RuntimeException('The directory '.$dir.' could not be created.');
}
Loading history...
15
        $url = $this->argument('url');
16
17
        $monitor = Monitor::where('url', $url)->first();
18
19
        if (! $monitor) {
20
            $this->error("Site {$url} is not configured");
21
22
            return;
23
        }
24
25
        if ($this->confirm("Are you sure you want stop monitoring {$monitor->url}?")) {
26
            $monitor->delete();
27
28
            $this->warn("{$monitor->url} will not be monitored anymore");
29
        }
30
    }
31
}
32