php-collection
php-collection copied to clipboard
What's the best way to get the map as an array that contains all the keys and values
Something like
$map->getAll()
I know you can just iterator_to_array($map). But I'm actually extending from the Map class, and I need to return the keys and values as the total array from a child class.
I was vary of adding such a method because it would have made it impossible to allow objects as keys. However since PHP 5.5 now also allows objects as array keys, I think we could add it.
Cool, so how will it be done?
It would be great, because that means I don't have to rely on the internals of the Map class. Right now I'm directly accessing $this->elements
, and of course that's not part of the public API nor interface.
Can you create a pull request which adds the all() method?
On Tue, Apr 8, 2014 at 12:46 AM, Roger Qiu [email protected] wrote:
It would be great, because that means I don't have to rely on the internals of the Map class. Right now I'm directly accessing $this->elements, and of course that's not part of the public API nor interface.
Reply to this email directly or view it on GitHubhttps://github.com/schmittjoh/php-collection/issues/14#issuecomment-39793198 .
Just all or getAll()?
https://github.com/schmittjoh/php-collection/pull/15
Any chance of getting a minor release?