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 ( efcda2...1a4696 )
by Freek
02:11
created

SiteRepository::downSites()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 6
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 9
rs 9.6666
1
<?php
2
3
namespace Spatie\UptimeMonitor;
4
5
use Illuminate\Support\Collection;
6
use Spatie\UptimeMonitor\Models\Enums\SslCertificateStatus;
7
use Spatie\UptimeMonitor\Models\Enums\UptimeStatus;
8
use Spatie\UptimeMonitor\Models\Site;
9
use Spatie\UptimeMonitor\Services\PingMonitors\SiteCollection;
10
11
class SiteRepository
12
{
13
    public static function getAllForUptimeCheck(): SiteCollection
14
    {
15
        $sites = Site::enabled()
16
            ->orderBy('url')
17
            ->get()
18
            ->filter(function (Site $site) {
19
                return $site->shouldCheckUptime();
20
            });
21
22
        return new SiteCollection($sites);
23
    }
24
25
    public static function getAllForSslCheck(): Collection
26
    {
27
        return Site::enabled()
28
            ->orderBy('url')
29
            ->where('check_ssl_certificate', true)
30
            ->get();
31
    }
32
33
    public static function healthySites(): Collection
34
    {
35
        return Site::enabled()
36
            ->orderBy('url')
37
            ->get()
38
            ->filter(function (Site $site) {
39
                return $site->isHealthy();
40
            });
41
    }
42
43
    public static function downSites()
44
    {
45
        return Site::enabled()
46
            ->orderBy('url')
47
            ->get()
48
            ->filter(function (Site $site) {
49
                return $site->uptime_status == UptimeStatus::DOWN;
50
            });
51
    }
52
53
    public static function withSslProblems()
54
    {
55
        return Site::enabled()
56
            ->orderBy('url')
57
            ->get()
58
            ->filter(function (Site $site) {
59
                return $site->ssl_certificate_status == SslCertificateStatus::INVALID;
60
            });
61
    }
62
63
    public static function unhealthySites(): Collection
64
    {
65
        return Site::enabled()
66
            ->orderBy('url')
67
            ->get()
68
            ->reject(function (Site $site) {
69
                return $site->isHealthy();
70
            });
71
    }
72
}