public static function pivotToTwoDimension(&$array, array $keys = [])
    {
        foreach ($keys as $key) {
            if (is_object($array)) {
                $array2 = clone $array;
            } else {
                $array2 = $array;
            }

            $array = Arr::set($array, $key, $array2);
        }

        return $array;
    }
public static function pivotToTwoDimension(&$array, array $keys = [])
    {
        foreach ($keys as $key) {
            if (is_object($array)) {
                $array2 = clone $array;
            } else {
                $array2 = $array;
            }

            $array = Arr::set($array, $key, $array2);
        }

        return $array;
    }
public static function pivotToTwoDimension ( & $ array , array $ keys = [ ] ) { foreach ( $ keys as $ key ) { if ( is_object ( $ array ) ) { $ array2 = clone $ array ; } else { $ array2 = $ array ; } $ array = Arr :: set ( $ array , $ key , $ array2 ) ; } return $ array ; }
Pivot one-dimensional array to two-dimensional array by a key list.

@param   array|object &$array Array to pivot.
@param   array         $keys  The fields' key list.

@return  array  Pivoted array.
Pivot one - dimensional array to two - dimensional array by a key list .