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

Judy::rewind() - undefined method? #11

Open
intel352 opened this issue Apr 1, 2013 · 5 comments
Open

Judy::rewind() - undefined method? #11

intel352 opened this issue Apr 1, 2013 · 5 comments
Assignees

Comments

@intel352
Copy link

intel352 commented Apr 1, 2013

Attempting to use rewind() w/ Judy 0.1.6, results in the error:
FatalErrorException: Error: Call to undefined method Judy::rewind()

Supposedly Judy implements Iterator, which requires rewind(), but it's not listed in the method list in the manual, and attempting to access rewind() results in an error.
So does Judy implement Iterator or not?

http://www.php.net/manual/en/class.judy.php < even shows here that Judy implements Iterator.

@orieg
Copy link
Owner

orieg commented Apr 1, 2013

The iterator method are implemented so a Judy object can be used in a foreach. The implementation is done overloading the zend_object_iterator. Methods are currently not exposed at the php level. I will look at exposing the missing methods.

@ghost ghost assigned orieg Apr 1, 2013
@intel352
Copy link
Author

intel352 commented Apr 1, 2013

That would be appreciated, having a bit of trouble trying to use Judy w/ the SPL iterators & classes.

Attempted to extend Judy w/ a class that implemented Iterator or IteratorAggregate, received error that it could not implement X interface. Additionally, Judy::next() definition may conflict w/ what's expected of Iterator, so that may be an issue...

@intel352
Copy link
Author

intel352 commented Apr 1, 2013

I've worked around it by building a class implementing Iterator, ArrayAccess, Countable, using Judy as a private property within. Would be quite awesome if my custom class were (at least partially) obsoleted by similar implementation in Judy ;-)

If I knew C & had the time, I'd contribute

@orieg
Copy link
Owner

orieg commented Apr 1, 2013

I will definitely look into this. Depending on my schedule, I may be able to get something out by end of week.

@stof
Copy link

stof commented Dec 7, 2015

@orieg this means you are not implementing Iterator. You are providing iteration support only (and you should at least implement Traversable, which would advocate this support to userland code, and allow to wrap it in an IteratorIterator if a real Iterator is needed)

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

3 participants