Code Duplication    Length = 8-9 lines in 3 locations

src/string.php 1 location

@@ 232-239 (lines=8) @@
229
 * @param  string $string
230
 * @return array
231
 */
232
function match() {
233
    $match = function($pattern, $string) {
234
        $results = [];
235
        preg_match_all($pattern, $string, $results);
236
        return $results[0];
237
    };
238
    return apply(curry($match), func_get_args());
239
}
240
241
/**
242
 * Curried version of `substr_count` with changed order of parameters,

src/list.php 1 location

@@ 106-114 (lines=9) @@
103
 * @param  array $list
104
 * @return array
105
 */
106
function each() {
107
    $each = function($fn, $list){
108
        foreach ($list as $item) {
109
            apply($fn, [$item]);
110
        }
111
        return $list;
112
    };
113
    return apply(curry($each), func_get_args());
114
}
115
116
/**
117
 * Returns the first item of the given array or string.

src/object.php 1 location

@@ 240-247 (lines=8) @@
237
 * @param  mixed $object
238
 * @return mixed
239
 */
240
function set() {
241
    $set = function($name, $value, $object) {
242
        return is_object($object)
243
            ? $object->{$name}
244
            : $object[$name];
245
    };
246
    return apply(curry($set), func_get_args());
247
}
248
249
/**
250
 * Checks if an attribute/value of an object/array passes the given predicate.