Code Duplication    Length = 19-20 lines in 2 locations

src/Auth/AbstractAuthentication.php 1 location

@@ 346-365 (lines=20) @@
343
     *
344
     * @return mixed
345
     */
346
    protected function arrayItem(array $array, $key, $default = null)
347
    {
348
        if (is_null($key)) {
349
            return $array;
350
        }
351
352
        if (isset($array[$key])) {
353
            return $array[$key];
354
        }
355
356
        foreach (explode('.', $key) as $segment) {
357
            if (!is_array($array) || !array_key_exists($segment, $array)) {
358
                return $default;
359
            }
360
361
            $array = $array[$segment];
362
        }
363
364
        return $array;
365
    }
366
367
    /**
368
     * Put state to session storage and return it.

src/Support/Arr.php 1 location

@@ 212-230 (lines=19) @@
209
     *
210
     * @return mixed
211
     */
212
    public static function get($array, $key, $default = null)
213
    {
214
        if (is_null($key)) {
215
            return $array;
216
        }
217
218
        if (isset($array[$key])) {
219
            return $array[$key];
220
        }
221
222
        foreach (explode('.', $key) as $segment) {
223
            if (!is_array($array) || !array_key_exists($segment, $array)) {
224
                return $default;
225
            }
226
            $array = $array[$segment];
227
        }
228
229
        return $array;
230
    }
231
232
    /**
233
     * Get a subset of the items from the given array.