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 ( 9e170a...fa9406 )
by Freek
04:03
created

CheckSslCertificates   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 14 1
1
<?php
2
3
namespace Spatie\UptimeMonitor\Commands;
4
5
use Spatie\SslCertificate\SslCertificate;
6
use Spatie\UptimeMonitor\Models\Site;
7
use Spatie\UptimeMonitor\Services\PingMonitors\UptimeMonitorCollection;
8
use Spatie\UptimeMonitor\SiteRepository;
9
10
class CheckSslCertificates extends BaseCommand
11
{
12
    /**
13
     * The name and signature of the console command.
14
     *
15
     * @var string
16
     */
17
    protected $signature = 'uptime-monitor:check-ssl';
18
19
    /**
20
     * The console command description.
21
     *
22
     * @var string
23
     */
24
    protected $description = 'Check the ssl certificates of all sites';
25
26
    public function handle()
27
    {
28
        $sites = SiteRepository::getAllForSslCheck();
29
30
        $this->comment('Start checking the ssl certificate of '.count($sites).' sites...');
31
32
        SiteRepository::getAllForSslCheck()->each(function(Site $site) {
33
            $this->info("Checking ssl-certificate of {$site->url}");
34
35
            $certificate = SslCertificate::createForHostName($site->url->getHost());
0 ignored issues
show
Unused Code introduced by
$certificate is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
36
        });
37
38
        $this->info('All done!');
39
    }
40
}
41