Completed
Pull Request — master (#5)
by Moesjarraf
09:47
created

JmesPath   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 1
c 1
b 0
f 1
lcom 0
cbo 2
dl 0
loc 18
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A applyToNode() 0 8 1
1
<?php
2
3
namespace LegalThings\DataEnricher\Processor;
4
5
use LegalThings\DataEnricher\Node;
6
use LegalThings\DataEnricher\Processor;
7
use JmesPath\search as jmespath_search;
8
9
/**
10
 * JMESPath processor
11
 * @see http://jmespath.org/
12
 */
13
class JmesPath implements Processor
14
{
15
    use Processor\Implementation;
16
    
17
    /**
18
     * Apply processing to a single node
19
     * 
20
     * @param Node $node
21
     */
22
    public function applyToNode(Node $node)
23
    {
24
        $path = $node->getInstruction($this);
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 2 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
25
        $input = $node->getResult();
26
        
27
        $result = jmespath_search($path, $input);
28
        $node->setResult($result);
29
    }
30
}
31