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 ( e97bb7...5f2eb5 )
by Pascal
10:40 queued 09:38
created

ApiHealthChecker::isPassing()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace ProtoneMedia\ApiHealth;
4
5
use ProtoneMedia\ApiHealth\Checkers\Executor;
6
use ProtoneMedia\ApiHealth\Storage\CheckerState;
7
8
class ApiHealthChecker
9
{
10
    /**
11
     * Boolean wether to use the state storage.
12
     *
13
     * @var bool
14
     */
15
    private $useStateStorage = true;
16
17
    /**
18
     * Disables the use of the state storage.
19
     *
20
     * @return $this
21
     */
22
    public function fresh()
23
    {
24
        $this->useStateStorage = false;
25
26
        return $this;
27
    }
28
29
    /**
30
     * Returns if the stored state is set to failed or runs the checker
31
     * if nothing is stored and returns wether the checker fails.
32
     *
33
     * @param  string $checkerClass
34
     * @return bool
35
     */
36
    public function isFailing(string $checkerClass): bool
37
    {
38
        if ($this->useStateStorage) {
39
            $storage = CheckerState::make($checkerClass);
40
41
            if ($storage->exists()) {
42
                return $storage->isFailing();
43
            }
44
        }
45
46
        $this->useStateStorage = true;
47
48
        return Executor::make($checkerClass)->fails();
49
    }
50
51
    /**
52
     * The opposite of the 'isFailing' method.
53
     *
54
     * @param  string $checkerClass
55
     * @return bool
56
     */
57
    public function isPassing(string $checkerClass): bool
58
    {
59
        return !$this->isFailing($checkerClass);
60
    }
61
}
62