Code Duplication    Length = 18-20 lines in 2 locations

src/Traits/StrictIterableTrait.php 1 location

@@ 241-260 (lines=20) @@
238
        return $results;
239
    }
240
241
    protected function concatRecurse($array, $array1)
242
    {
243
        $merged = $array;
244
245
        foreach ($array1 as $key => $value) {
246
            $isValid = function ($value) {
247
                return (is_array($value) || $value instanceof \Traversable);
248
            };
249
250
            if (($isValid($value) && isset($merged[$key])) && $isValid($merged[$key])) {
251
                $merged[$key] = $this->concatRecurse($merged[$key], $value);
252
            } else {
253
                if (!in_array($value, $merged->toArray())) {
254
                    $merged[] = $value;
255
                }
256
            }
257
        }
258
259
        return $merged;
260
    }
261
}
262

src/Traits/StrictKeyedIterableTrait.php 1 location

@@ 223-240 (lines=18) @@
220
        return $results;
221
    }
222
223
    protected function concatRecurse($array, $array1)
224
    {
225
        $merged = $array;
226
227
        foreach ($array1 as $key => $value) {
228
            $isValid = function ($value) {
229
                return (is_array($value) || $value instanceof \Traversable);
230
            };
231
232
            if (($isValid($value) && isset($merged[$key])) && $isValid($merged[$key])) {
233
                $merged[$key] = $this->concatRecurse($merged[$key], $value);
234
            } else {
235
                $merged[$key] = $value;
236
            }
237
        }
238
239
        return $merged;
240
    }
241
}
242