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

XorRule::__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 'XOR' operator one of the rules given in the
6
 * constructor should apply.
7
 *
8
 * @author romuald villetet
9
 */
10
class XorRule extends Rule {
11
    /**
12
     *
13
     * @var Rule
14
     */
15
    private $original;
16
    /**
17
     *
18
     * @var Rule
19
     */
20
    private $other;
21
22
    /**
23
     *
24
     * @param Rule $original            
25
     * @param Rule $other            
26
     */
27 3
    public function __construct(Rule $original, Rule $other)
28
    {
29 3
        $this->original = $original;
30 3
        $this->other = $other;
31 3
    }
32
33 3
    public function _applies()
34
    {
35 3
        return (boolean) ($this->original->applies() ^ $this->other->applies());
36
    }
37
38
    /**
39
     *
40
     * @return string
41
     */
42 1
    public function toString()
43
    {
44
        // includes the namespace
45 1
        $original = $this->original->toString();
46 1
        $other = $this->other->toString();
47 1
        return "($original xor $other)";
48
    }
49
50
    /**
51
     * Merge results
52
     *
53
     * @return array
54
     */
55 1
    public function getResults()
56
    {
57 1
        return array_merge($this->other->getResults(), $this->original->getResults());
58
    }
59
}