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 ( b905f6...efedee )
by Freek
01:58
created

DownSites::display()   B

Complexity

Conditions 3
Paths 2

Size

Total Lines 33
Code Lines 18

Duplication

Lines 17
Ratio 51.52 %

Importance

Changes 0
Metric Value
cc 3
eloc 18
nc 2
nop 0
dl 17
loc 33
rs 8.8571
c 0
b 0
f 0
1
<?php
2
3
namespace Spatie\UptimeMonitor\Commands\UptimeMonitorLists;
4
5
use Illuminate\Console\Command;
6
use Spatie\UptimeMonitor\Helpers\Emoji;
7
use Spatie\UptimeMonitor\Models\Site;
8
use Spatie\UptimeMonitor\SiteRepository;
9
10
class DownSites
11
{
12
    protected $output;
13
14
    public function __construct(Command $output)
15
    {
16
        $this->output = $output;
17
    }
18
19
    public function display()
20
    {
21
        $downSites = SiteRepository::downSites();
22
23
        if (! $downSites->count()) {
24
            return;
25
        }
26
27
        $this->output->info('Sites that are down');
28
        $this->output->info('===================');
29
30 View Code Duplication
        $rows = $downSites->map(function (Site $site) {
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...
31
            $url = $site->url;
32
33
            $reachable = $site->reachableAsEmoji;
34
35
            $offlineSince = $site->formattedLastUpdatedStatusChangeDate;
36
37
            $reason = $site->chunkedLastFailureReason;
38
39
            if ($site->check_ssl_certificate) {
40
                $sslCertificateFound = Emoji::ok();
41
                $sslCertificateExpirationDate = $site->formattedSslCertificateExpirationDate;
42
                $sslCertificateIssuer = $site->ssl_certificate_issuer;
43
            }
44
45
            return compact('url', 'reachable', 'offlineSince', 'reason', 'sslCertificateFound', 'sslCertificateExpirationDate', 'sslCertificateIssuer');
46
        });
47
48
        $titles = ['URL', 'Reachable', 'Offline since', 'Reason', 'SSL Certificate', 'SSL Expiration date', 'SSL Issuer'];
49
50
        $this->output->table($titles, $rows);
51
    }
52
}