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
Pull Request — master (#33)
by Freek
02:12
created

Healthy::display()   B

Complexity

Conditions 3
Paths 2

Size

Total Lines 32
Code Lines 18

Duplication

Lines 15
Ratio 46.88 %

Importance

Changes 0
Metric Value
dl 15
loc 32
rs 8.8571
c 0
b 0
f 0
cc 3
eloc 18
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
            $url = $monitor->url;
24
25
            $reachable = $monitor->reachableAsEmoji;
26
27
            $onlineSince = $monitor->formattedLastUpdatedStatusChangeDate;
28
29
            if ($monitor->certificate_check_enabled) {
30
                $certificateFound = $monitor->certificateStatusAsEmoji;
31
                $certificateExpirationDate = $monitor->formattedCertificateExpirationDate;
32
                $certificateIssuer = $monitor->certificate_issuer;
33
            }
34
35
            return compact('url', 'reachable', 'onlineSince', 'certificateFound', 'certificateExpirationDate', 'certificateIssuer');
36
        });
37
38
        $titles = ['URL', 'Uptime check', 'Online since', 'Certificate Certificate check', 'Certificate Expiration date', 'Certificate Issuer'];
39
40
        ConsoleOutput::table($titles, $rows);
41
        ConsoleOutput::line('');
42
    }
43
}
44