Reference::applyToNode()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7

Duplication

Lines 7
Ratio 100 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
dl 7
loc 7
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
namespace LegalThings\DataEnricher\Processor;
4
5
use LegalThings\DataEnricher\Node;
6
use LegalThings\DataEnricher\Processor;
7
8
/**
9
 * Reference JMESPath processor
10
 * @see http://jmespath.org/
11
 */
12 View Code Duplication
class Reference implements Processor
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
13
{
14
    use Processor\Implementation,
15
        Helper\GetByReference
16
    {
17
        Helper\GetByReference::withSourceAndTarget insteadof Processor\Implementation;
18
    }
19
    
20
    /**
21
     * Apply processing to a single node
22
     * 
23
     * @param Node $node
24
     */
25 5
    public function applyToNode(Node $node)
26
    {
27 5
        $ref = $node->getInstruction($this);
28
        
29 5
        $result = $this->getByReference($ref, $this->source, $this->target);
30 5
        $node->setResult($result);
31 5
    }
32
}
33