Failed Conditions
Push — master ( 880422...c8eef9 )
by Arnold
16s queued 11s
created

Evaluate::applyToNode()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 8
Ratio 100 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
dl 8
loc 8
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
use function JmesPath\search as jmespath_search;
8
9
/**
10
 * Process JMESPath compatible expression
11
 * @see http://jmespath.org/
12
 */
13 View Code Duplication
class Evaluate 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...
14
{
15
    use Processor\Implementation,
16
        Helper\GetByReference
17
    {
18
        Helper\GetByReference::withSourceAndTarget insteadof Processor\Implementation;
19
    }
20
21
    /**
22
     * Apply processing to a single node
23
     *
24
     * @param Node $node
25
     */
26 8
    public function applyToNode(Node $node)
27
    {
28 8
        $instruction = $node->getInstruction($this);
29
30 8
        $result = jmespath_search($instruction, $this->source);
31
32 8
        $node->setResult($result);
33 8
    }
34
}
35