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   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 3
Bugs 0 Features 0
Metric Value
wmc 4
c 3
b 0
f 0
lcom 1
cbo 1
dl 0
loc 50
ccs 12
cts 12
cp 1
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A _applies() 0 4 1
A toString() 0 7 1
A getResults() 0 4 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
}