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.

Healthy::display()   A
last analyzed

Complexity

Conditions 3
Paths 2

Size

Total Lines 36

Duplication

Lines 20
Ratio 55.56 %

Importance

Changes 0
Metric Value
dl 20
loc 36
rs 9.344
c 0
b 0
f 0
cc 3
nc 2
nop 0
1
<?php
2
3
namespace Spatie\UptimeMonitor\Commands\MonitorLists;
4
5
use Spatie\UptimeMonitor\Helpers\ConsoleOutput;
6
use Spatie\UptimeMonitor\Models\Monitor;
7
use Spatie\UptimeMonitor\MonitorRepository;
8
9
class Healthy
10
{
11
    public static function display()
12
    {
13
        $healthyMonitor = MonitorRepository::getHealthy();
14
15
        if (! $healthyMonitor->count()) {
16
            return;
17
        }
18
19
        ConsoleOutput::info('Healthy monitors');
20
        ConsoleOutput::info('================');
21
22 View Code Duplication
        $rows = $healthyMonitor->map(function (Monitor $monitor) {
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...
23
            $certificateFound = '';
24
            $certificateExpirationDate = '';
25
            $certificateIssuer = '';
26
27
            $url = $monitor->url;
28
29
            $reachable = $monitor->uptimeStatusAsEmoji;
30
31
            $onlineSince = $monitor->formattedLastUpdatedStatusChangeDate('forHumans');
32
33
            if ($monitor->certificate_check_enabled) {
34
                $certificateFound = $monitor->certificateStatusAsEmoji;
35
                $certificateExpirationDate = $monitor->formattedCertificateExpirationDate('forHumans');
36
                $certificateIssuer = $monitor->certificate_issuer;
37
            }
38
39
            return compact('url', 'reachable', 'onlineSince', 'certificateFound', 'certificateExpirationDate', 'certificateIssuer');
40
        });
41
42
        $titles = ['URL', 'Uptime check', 'Online since', 'Certificate check', 'Certificate Expiration date', 'Certificate Issuer'];
43
44
        ConsoleOutput::table($titles, $rows);
45
        ConsoleOutput::line('');
46
    }
47
}
48