Object oriented helper for convenient methods chaining
Added new class ArrObj
which can be used to easily chain Arr
methods.
ArrObj
instance can be obtained by either explicitly calling it's constructor with new ArrObj(...)
or for even easier chaining Arr::obj(...)
method.
Examples:
// Chain setting nested array values
Arr::obj()->set('foo', 'bar')->set('test.[]', 'test')->getArray() ->
[
'foo' => 'bar',
'test' => ['test']
]
// Quickly flatten array of objects grouped by id
Arr::obj([...])->groupObjects('getId')->flattenSingle()->getArray()
What's more, ArrObj
contain PHPDoc for every method that can be used in it, so you can take advantage of your editor autocomplete feature.
Full documentation of this feature, coming soon.