Failed Conditions
Push — master ( 0bbe18...211e20 )
by Moesjarraf
03:53
created

Equal   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 71.43%

Importance

Changes 0
Metric Value
wmc 3
c 0
b 0
f 0
lcom 0
cbo 2
dl 0
loc 21
ccs 5
cts 7
cp 0.7143
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A applyToNode() 0 11 3
1
<?php
2
3
namespace LegalThings\DataEnricher\Processor;
4
5
use LegalThings\DataEnricher\Node;
6
use LegalThings\DataEnricher\Processor;
7
8
/**
9
 * Equal processor
10
 */
11
class Equal implements Processor
12
{
13
    use Processor\Implementation;
14
    
15
    /**
16
     * Apply processing to a single node
17
     * 
18
     * @param Node $node
19
     */
20 7
    public function applyToNode(Node $node)
21
    {
22 7
        $instruction = $node->getInstruction($this);
23
        
24 7
        if (!is_array($instruction) || count($instruction) !== 2) {
25
            $node->setResult(false);
26
        }
27
        
28
        // might want to improve this check for different types using a library
29 7
        $node->setResult($instruction[0] == $instruction[1]);
30 7
    }
31
}
32