Code Duplication    Length = 21-23 lines in 2 locations

src/helpers.php 2 locations

@@ 56-78 (lines=23) @@
53
    }
54
}
55
56
if ( ! function_exists('array_build'))
57
{
58
    /**
59
     * Build a new array using a callback.
60
     *
61
     * @param  array     $array
62
     * @param  \Closure  $callback
63
     * @return array
64
     */
65
    function array_build($array, Closure $callback)
66
    {
67
        $results = array();
68
69
        foreach ($array as $key => $value)
70
        {
71
            list($innerKey, $innerValue) = call_user_func($callback, $key, $value);
72
73
            $results[$innerKey] = $innerValue;
74
        }
75
76
        return $results;
77
    }
78
}
79
80
if ( ! function_exists('array_divide'))
81
{
@@ 428-448 (lines=21) @@
425
    }
426
}
427
428
if ( ! function_exists('array_where'))
429
{
430
    /**
431
     * Filter the array using the given Closure.
432
     *
433
     * @param  array     $array
434
     * @param  \Closure  $callback
435
     * @return array
436
     */
437
    function array_where($array, Closure $callback)
438
    {
439
        $filtered = array();
440
441
        foreach ($array as $key => $value)
442
        {
443
            if (call_user_func($callback, $key, $value)) $filtered[$key] = $value;
444
        }
445
446
        return $filtered;
447
    }
448
}
449
450
if ( ! function_exists('camel_case'))
451
{