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 ( 7e29ef...6c81d7 )
by Freek
01:30
created

EnableMonitor   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A handle() 0 6 2
A enableMonitor() 0 12 2
1
<?php
2
3
namespace Spatie\UptimeMonitor\Commands;
4
5
use Spatie\UptimeMonitor\MonitorRepository;
6
7
class EnableMonitor extends BaseCommand
8
{
9
    protected $signature = 'monitor:enable {url}';
10
11
    protected $description = 'Enable a monitor';
12
13
    public function handle()
14
    {
15
        foreach (explode(',', $this->argument('url')) as $url) {
16
            $this->enableMonitor(trim($url));
17
        }
18
    }
19
20
    protected function enableMonitor(string $url)
0 ignored issues
show
Coding Style Best Practice introduced by
Please use __construct() instead of a PHP4-style constructor that is named after the class.
Loading history...
21
    {
22
        if (! $monitor = MonitorRepository::findByUrl($url)) {
23
            $this->error("There is no monitor configured for url `{$url}`.");
24
25
            return;
26
        }
27
28
        $monitor->enable();
29
30
        $this->info("The checks for url `{$url}` are now enabled.");
31
    }
32
}
33