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.

Code Duplication    Length = 31-32 lines in 2 locations

src/Commands/DisableMonitor.php 1 location

@@ 9-40 (lines=32) @@
6
use Spatie\UptimeMonitor\MonitorRepository;
7
use Spatie\Url\Url;
8
9
class DisableMonitor extends BaseCommand
10
{
11
    protected $signature = 'monitor:disable {url}';
12
13
    protected $description = 'Disable monitors';
14
15
    public function handle()
16
    {
17
        foreach (explode(',', $this->argument('url')) as $url) {
18
            $this->disableMonitor(trim($url));
19
        }
20
    }
21
22
    protected function disableMonitor(string $url)
23
    {
24
        if (! $monitor = MonitorRepository::findByUrl($url)) {
25
            $this->error("There is no monitor configured for url `{$url}`.");
26
27
            return;
28
        }
29
30
        if (! $monitor->enabled) {
31
            $this->warn("The monitor for url `{$url}` was already disabled.");
32
33
            return;
34
        }
35
36
        $monitor->disable();
37
38
        $this->info("The monitor for url `{$url}` is now disabled");
39
    }
40
}
41

src/Commands/EnableMonitor.php 1 location

@@ 9-39 (lines=31) @@
6
use Spatie\UptimeMonitor\MonitorRepository;
7
use Spatie\Url\Url;
8
9
class EnableMonitor extends BaseCommand
10
{
11
    protected $signature = 'monitor:enable {url}';
12
13
    protected $description = 'Enable a monitors';
14
15
    public function handle()
16
    {
17
        foreach (explode(',', $this->argument('url')) as $url) {
18
            $this->enableMonitor(trim($url));
19
        }
20
    }
21
22
    protected function enableMonitor(string $url)
23
    {
24
        if (! $monitor = MonitorRepository::findByUrl($url)) {
25
            $this->error("There is no monitor configured for url `{$url}`.");
26
27
            return;
28
        }
29
30
        if ($monitor->enabled) {
31
            $this->warn("The monitor for url `{$url}` was already enabled.");
32
33
            return;
34
        }
35
36
        $monitor->enable();
37
        $this->info("The monitor for url `{$url}` is now enabled");
38
    }
39
}
40