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

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