php-dot-notation icon indicating copy to clipboard operation
php-dot-notation copied to clipboard

Array unflatten feature

Open DJames239 opened this issue 4 years ago • 2 comments

I noticed there was an open issue for this: https://github.com/adbario/php-dot-notation/issues/19. I also needed this for a private project I'm working on recently. Thought I'd kill two birds with one stone and create a PR with my changes.

If you have any questions or feedback please let me know.

DJames239 avatar Feb 17 '21 23:02 DJames239

Coverage Status

Coverage decreased (-0.6%) to 99.405% when pulling a9189e26c519da5c9c69cf6ba6cca728c5b19aea on DJames239:array-unflatten-feature into 3857c8cfb32b866fcc12fb9ffd1f401c431da43b on adbario:2.x.

coveralls avatar Mar 25 '22 03:03 coveralls

Thanks for the PR 👍

The set method already unflattens the given array, there's currently no option to pass a key delimiter though. Also, the new method doesn't rely on anything within the Dot class, but using it requires an existing instance of the class. For these reasons, feels like a separate helper function would be a better option.

adbario avatar Mar 25 '22 04:03 adbario

Closing as no further comments from OP.

adbario avatar Sep 25 '22 21:09 adbario