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 ( 409123...1f0c23 )
by Freek
02:30 queued 49s
created

HealthySites::display()   B

Complexity

Conditions 3
Paths 2

Size

Total Lines 32
Code Lines 17

Duplication

Lines 16
Ratio 50 %

Importance

Changes 0
Metric Value
cc 3
eloc 17
nc 2
nop 0
dl 16
loc 32
rs 8.8571
c 0
b 0
f 0
1
<?php
2
3
namespace Spatie\UptimeMonitor\Commands\SiteLists;
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 HealthySites
11
{
12
    protected $output;
13
14
    public function __construct(Command $output)
15
    {
16
        $this->output = $output;
17
    }
18
19
    public function display()
20
    {
21
        $healthySites = SiteRepository::healthySites();
22
23
        if (! $healthySites->count()) {
24
            return;
25
        }
26
27
        $this->output->info('Healthy sites');
28
        $this->output->info('============');
29
30 View Code Duplication
        $rows = $healthySites->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
            $onlineSince = $site->formattedLastUpdatedStatusChangeDate;
36
37
            if ($site->check_ssl_certificate) {
38
                $sslCertificateFound = Emoji::ok();
39
                $sslCertificateExpirationDate = $site->formattedSslCertificateExpirationDate;
40
                $sslCertificateIssuer = $site->ssl_certificate_issuer;
41
            }
42
43
44
            return compact('url', 'reachable', 'onlineSince', 'sslCertificateFound', 'sslCertificateExpirationDate', 'sslCertificateIssuer');
45
        });
46
47
        $titles = ['URL', 'Reachable', 'Online since', 'SSL Certifcate', 'SSL Expiration date', 'SSL Issuer'];
48
49
        $this->output->table($titles, $rows);
50
    }
51
}
52