Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What's the best way to get the map as an array that contains all the keys and values #14

Open
CMCDragonkai opened this issue Apr 7, 2014 · 7 comments

Comments

@CMCDragonkai
Copy link
Contributor

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.

@schmittjoh
Copy link
Owner

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.

@CMCDragonkai
Copy link
Contributor Author

Cool, so how will it be done?

@CMCDragonkai
Copy link
Contributor Author

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.

@schmittjoh
Copy link
Owner

Can you create a pull request which adds the all() method?

On Tue, Apr 8, 2014 at 12:46 AM, Roger Qiu notifications@github.com 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//issues/14#issuecomment-39793198
.

@CMCDragonkai
Copy link
Contributor Author

Just all or getAll()?

@CMCDragonkai
Copy link
Contributor Author

#15

@CMCDragonkai
Copy link
Contributor Author

Any chance of getting a minor release?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants