src/Traits/Collections.php
public static function mapValues(array $array, Closure $closure = null): array
    {
        if (is_null($closure)) {
            $closure = '__::identity';
        }
        $resultArray = [];
        foreach ($array as $key => $value) {
            $resultArray[$key] = call_user_func_array($closure, [$value, $key, $array]);
        }

        return $resultArray;
    }
public static function mapValues(array $array, Closure $closure = null): array
    {
        if (is_null($closure)) {
            $closure = '__::identity';
        }
        $resultArray = [];
        foreach ($array as $key => $value) {
            $resultArray[$key] = call_user_func_array($closure, [$value, $key, $array]);
        }

        return $resultArray;
    }
public static function mapValues ( array $ array , Closure $ closure = null ) : array { if ( is_null ( $ closure ) ) { $ closure = '__::identity' ; } $ resultArray = [ ] ; foreach ( $ array as $ key => $ value ) { $ resultArray [ $ key ] = call_user_func_array ( $ closure , [ $ value , $ key , $ array ] ) ; } return $ resultArray ; }
Transforms the values in a collection by running each value through the iterator

@param array    $array   array of values
@param \Closure $closure closure to map the values

@return array
Transforms the values in a collection by running each value through the iterator