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.

CheckUptime::handle()   A
last analyzed

Complexity

Conditions 3
Paths 4

Size

Total Lines 16

Duplication

Lines 5
Ratio 31.25 %

Importance

Changes 0
Metric Value
dl 5
loc 16
rs 9.7333
c 0
b 0
f 0
cc 3
nc 4
nop 0
1
<?php
2
3
namespace Spatie\UptimeMonitor\Commands;
4
5
use Spatie\UptimeMonitor\Models\Monitor;
6
use Spatie\UptimeMonitor\MonitorRepository;
7
8
class CheckUptime extends BaseCommand
9
{
10
    protected $signature = 'monitor:check-uptime
11
                            {--url= : Only check these urls}
12
                            {--f|force : Force run all monitors }';
13
14
    protected $description = 'Check the uptime of all sites';
15
16
    public function handle()
17
    {
18
        $monitors = $this->option('force') ? MonitorRepository::getEnabled() : MonitorRepository::getForUptimeCheck();
19
20 View Code Duplication
        if ($url = $this->option('url')) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
21
            $monitors = $monitors->filter(function (Monitor $monitor) use ($url) {
22
                return in_array((string) $monitor->url, explode(',', $url));
23
            });
24
        }
25
26
        $this->comment('Start checking the uptime of '.count($monitors).' monitors...');
27
28
        $monitors->checkUptime();
29
30
        $this->info('All done!');
31
    }
32
}
33