Skip to content

Commit

Permalink
Roll back changes to undot because the former was simpler and functional
Browse files Browse the repository at this point in the history
  • Loading branch information
borkweb committed Dec 18, 2024
1 parent 79353e0 commit 880c931
Showing 1 changed file with 1 addition and 15 deletions.
16 changes: 1 addition & 15 deletions src/Arrays/Arr.php
Original file line number Diff line number Diff line change
Expand Up @@ -1355,21 +1355,7 @@ public static function undot( $array ) {
$results = [];

foreach ( $array as $key => $value ) {
if ( ! is_string( $key ) ) {
$results[ $key ] = $value;
continue;
}

$parts = explode('.', $key);

$current = &$results;
foreach ( $parts as $part ) {
if ( ! isset( $current[ $part ] ) ) {
$current[ $part ] = [];
}
$current = &$current[ $part ];
}
$current = $value;
$results = static::set( $results, explode( '.', $key ), $value );
}

return $results;
Expand Down

0 comments on commit 880c931

Please sign in to comment.