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

@@ 161-170 (lines=10) @@
158
     * 
159
     * @param array|object $target
160
     */
161
    protected function applyNodeResults(&$target)
162
    {
163
        foreach ($target as &$value) {
164
            if ($value instanceof Node) {
165
                $value = $value->getResult();
166
            } elseif (is_array($value) || is_object($value)) {
167
                $this->applyNodeResults($value);
168
            }
169
        }
170
    }
171
}
172