Code Duplication    Length = 9-10 lines in 2 locations

src/object.php 2 locations

@@ 180-188 (lines=9) @@
177
 * @param  array $object
178
 * @return mixed
179
 */
180
function get() {
181
    $get = function($name, $object){
182
        $object = attributes($object);
183
        return has($name, $object)
184
            ? $object[$name]
185
            : null;
186
    };
187
    return apply(curry($get), func_get_args());
188
}
189
190
/**
191
 * Gets a value from an array/object using a path of keys/attributes.
@@ 208-217 (lines=10) @@
205
 * @param  mixed $object
206
 * @return mixed
207
 */
208
function getPath() {
209
    $getPath = function($path, $object){
210
        return reduce(function($result, $name) {
211
            if ($result !== null)
212
                $result = get($name, $result);
213
            return $result;
214
        }, $object, $path);
215
    };
216
    return apply(curry($getPath), func_get_args());
217
}
218
219
/**
220
 * Returns a new array or object with the value of a key or a public attribute set