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 — develop ( 50cef7...02ca20 )
by Rolf
01:54
created

OrRule::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 5
ccs 4
cts 4
cp 1
rs 9.4285
cc 1
eloc 3
nc 1
nop 2
crap 1
1
<?php
2
namespace izzum\rules;
3
4
/**
5
 * When a rule is chained using the 'OR' operator only one of the rules given in
6
 * the
7
 * constructor needs to apply.
8
 *
9
 * $rule = new TrueRule();
10
 * $chained = $rule->orRule(new FalseRule());
11
 * $chained->applies();//true, since true or false is true.
12
 *
13
 * @author Rolf Vreijdenberger
14
 * @author Richard Ruiter
15
 */
16
class OrRule extends Rule {
17
    /**
18
     *
19
     * @var Rule
20
     */
21
    private $original;
22
    /**
23
     *
24
     * @var Rule
25
     */
26
    private $other;
27
28
    /**
29
     *
30
     * @param Rule $original
31
     * @param Rule $other
32
     */
33 3
    public function __construct(Rule $original, Rule $other)
34
    {
35 3
        $this->original = $original;
36 3
        $this->other = $other;
37 3
    }
38
39 3
    public function _applies()
40
    {
41 3
        return (boolean) $this->original->applies() || $this->other->applies();
42
    }
43
44
    /**
45
     *
46
     * @return string
47
     */
48 1
    public function toString()
49
    {
50
        // includes the namespace
51 1
        $original = $this->original->toString();
52 1
        $other = $this->other->toString();
53 1
        return "($original or $other)";
54
    }
55
56
    /**
57
     * Merge results
58
     *
59
     * @return array
60
     */
61 1
    public function getResults()
62
    {
63 1
        return array_merge($this->other->getResults(), $this->original->getResults());
64
    }
65
}