Failed Conditions
Pull Request — master (#32)
by Moesjarraf
08:35
created

Equal   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
c 0
b 0
f 0
lcom 0
cbo 2
dl 0
loc 21
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
    public function applyToNode(Node $node)
21
    {
22
        $instruction = $node->getInstruction($this);
23
        
24
        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
        $node->setResult($instruction[0] == $instruction[1]);
30
    }
31
}
32