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.

ApiHealthFake   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 66
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 66
rs 10
c 0
b 0
f 0
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A mustPass() 0 5 1
A fresh() 0 3 1
A isFailing() 0 3 1
A isPassing() 0 3 1
A mustFail() 0 5 1
1
<?php
2
3
namespace ProtoneMedia\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