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 ( c5d772...25d9a0 )
by Pascal
02:48
created

ApiHealthFake::isFailing()   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 Pbmedia\ApiHealth\Testing;
4
5
class ApiHealthFake
6
{
7
    /**
8
     * An array of checkers where the value is the desired status.
9
     *
10
     * @var array
11
     */
12
    private $fakedStates = [];
13
14
    /**
15
     * Marks the given checker as failing.
16
     *
17
     * @param  string $checkerClass
18
     * @return $this
19
     */
20
    public function mustFail(string $checkerClass)
21
    {
22
        $this->fakedStates[$checkerClass] = false;
23
24
        return $this;
25
    }
26
27
    /**
28
     * Marks the given checker as passing.
29
     *
30
     * @param  string $checkerClass
31
     * @return $this
32
     */
33
    public function mustPass(string $checkerClass)
34
    {
35
        $this->fakedStates[$checkerClass] = true;
36
37
        return $this;
38
    }
39
40
    /**
41
     * Returns this instance.
42
     *
43
     * @return $this
44
     */
45
    public function fresh()
46
    {
47
        return $this;
48
    }
49
50
    /**
51
     * Returns if the stored state is set to failed or runs the checker
52
     * if nothing is stored and returns wether the checker fails.
53
     *
54
     * @param  string $checkerClass
55
     * @return bool
56
     */
57
    public function isFailing(string $checkerClass): bool
58
    {
59
        return !$this->fakedStates[$checkerClass];
60
    }
61
62
    /**
63
     * The opposite of the 'isFailing' method.
64
     *
65
     * @param  string $checkerClass
66
     * @return bool
67
     */
68
    public function isPassing(string $checkerClass): bool
69
    {
70
        return !$this->isFailing($checkerClass);
71
    }
72
}
73