Code Duplication    Length = 10-14 lines in 3 locations

src/DataEnricher/Node.php 2 locations

@@ 43-53 (lines=11) @@
40
     * 
41
     * @param array|object $target
42
     */
43
    protected function applyNodeResults(&$target)
44
    {
45
        if ($target instanceof self) {
46
            $target = $target->getResult();
47
            $this->applyNodeResults($target);
48
        } elseif (is_array($target) || is_object($target)) {
49
            foreach ($target as &$value) {         
50
                $this->applyNodeResults($value);
51
            }
52
        }
53
    }
54
    
55
    /**
56
     * Get the processed result
@@ 122-135 (lines=14) @@
119
     * @param mixed $value
120
     * @return mixed
121
     */
122
    protected function resolve($value)
123
    {
124
        while ($value instanceof self) {
125
            $value = $value->getResult();
126
        }
127
        
128
        if (is_array($value) || is_object($value)) {
129
            foreach ($value as &$item) {
130
                $item = $this->resolve($item);
131
            }
132
        }
133
        
134
        return $value;
135
    }
136
    
137
    /**
138
     * Apply processing to this node

src/DataEnricher.php 1 location

@@ 173-182 (lines=10) @@
170
     * 
171
     * @param array|object $target
172
     */
173
    protected function applyNodeResults(&$target)
174
    {
175
        foreach ($target as &$value) {
176
            if ($value instanceof Node) {
177
                $value = $value->getResult();
178
            } elseif (is_array($value) || is_object($value)) {
179
                $this->applyNodeResults($value);
180
            }
181
        }
182
    }
183
}
184