Code Duplication    Length = 14-14 lines in 2 locations

src/DataEnricher/Processor/Enrich.php 2 locations

@@ 38-51 (lines=14) @@
35
        
36
        $extraIndexed = [];
37
        
38
        foreach ($instruction->extra as $extra) {
39
            $key = \Jasny\DotKey::on($extra)->get($match['extra']);
40
            
41
            if (!isset($key) || isset($extraIndexed[$key])) {
42
                continue;
43
            }
44
            
45
            if (!is_scalar($key)) {
46
                trigger_error("Trying to match on non-scalar type", E_USER_WARNING);
47
                continue;
48
            }
49
            
50
            $extraIndexed[$key] = $extra;
51
        }
52
        
53
        foreach ($source as &$item) {
54
            $key = \Jasny\DotKey::on($item)->get($match['source']);
@@ 53-66 (lines=14) @@
50
            $extraIndexed[$key] = $extra;
51
        }
52
        
53
        foreach ($source as &$item) {
54
            $key = \Jasny\DotKey::on($item)->get($match['source']);
55
            
56
            if (!isset($key) || !isset($extraIndexed[$key])) {
57
                continue;
58
            }
59
            
60
            if (!is_scalar($key)) {
61
                trigger_error("Trying to match on non-scalar type", E_USER_WARNING);
62
                continue;
63
            }
64
            
65
            $item = array_merge((array)$item, (array)$extraIndexed[$key]);
66
        }
67
        
68
        $node->setResult($source);
69
    }