Code Duplication    Length = 9-14 lines in 2 locations

src/Arr.php 2 locations

@@ 142-150 (lines=9) @@
139
        foreach ($keys as $key) {
140
            $parts = explode('.', $key);
141
142
            while (count($parts) > 1) {
143
                $part = array_shift($parts);
144
145
                if (isset($array[$part]) && is_array($array[$part])) {
146
                    $array = &$array[$part];
147
                } else {
148
                    $parts = array();
149
                }
150
            }
151
152
            unset($array[array_shift($parts)]);
153
@@ 257-270 (lines=14) @@
254
255
        $keys = explode('.', $key);
256
257
        while (count($keys) > 1)
258
        {
259
            $key = array_shift($keys);
260
261
            // If the key doesn't exist at this depth, we will just create an empty array
262
            // to hold the next value, allowing us to create the arrays to hold final
263
            // values at the correct depth. Then we'll keep digging into the array.
264
            if ( ! isset($array[$key]) || ! is_array($array[$key]))
265
            {
266
                $array[$key] = array();
267
            }
268
269
            $array =& $array[$key];
270
        }
271
272
        $array[array_shift($keys)] = $value;
273