Code Duplication    Length = 34-34 lines in 2 locations

src/helpers.php 2 locations

@@ 223-256 (lines=34) @@
220
    }
221
}
222
223
if ( ! function_exists('array_forget'))
224
{
225
    /**
226
     * Remove one or many array items from a given array using "dot" notation.
227
     *
228
     * @param  array  $array
229
     * @param  array|string  $keys
230
     * @return void
231
     */
232
    function array_forget(&$array, $keys)
233
    {
234
        $original =& $array;
235
236
        foreach ((array) $keys as $key)
237
        {
238
            $parts = explode('.', $key);
239
240
            while (count($parts) > 1)
241
            {
242
                $part = array_shift($parts);
243
244
                if (isset($array[$part]) && is_array($array[$part]))
245
                {
246
                    $array =& $array[$part];
247
                }
248
            }
249
250
            unset($array[array_shift($parts)]);
251
252
            // clean up after each pass
253
            $array =& $original;
254
        }
255
    }
256
}
257
258
if ( ! function_exists('array_get'))
259
{
@@ 1066-1099 (lines=34) @@
1063
    }
1064
}
1065
1066
if ( ! function_exists('forget'))
1067
{
1068
    /**
1069
     * Remove one or many array items from a given array using "dot" notation.
1070
     *
1071
     * @param  array  $array
1072
     * @param  array|string  $keys
1073
     * @return void
1074
     */
1075
    function forget(&$array, $keys)
1076
    {
1077
        $original =& $array;
1078
1079
        foreach ((array) $keys as $key)
1080
        {
1081
            $parts = explode('.', $key);
1082
1083
            while (count($parts) > 1)
1084
            {
1085
                $part = array_shift($parts);
1086
1087
                if (isset($array[$part]) && is_array($array[$part]))
1088
                {
1089
                    $array =& $array[$part];
1090
                }
1091
            }
1092
1093
            unset($array[array_shift($parts)]);
1094
1095
            // clean up after each pass
1096
            $array =& $original;
1097
        }
1098
    }
1099
}