So we could do something like:
$e->next_sibling()->next_sibling(6)->plaintext;
instead of:
$e->next_sibling()->next_sibling()->next_sibling()->next_sibling()->next_sibling()->next_sibling()->plaintext;
You have a point there but I don't think next_sibling and prev_sibling should be changed, they are quite precise in what you'd expect from them.
That said I can see a use, in line with our $e->children($idx) I would imagine we would find useful a $e->siblings($idx) method but if you think about it that doesn't make sense either, right?
Why don't you use:
$e->parent()->children(6)->plaintext;
Instead which does exactly what you need, can already be done and has no ambiguity attached, do you agree?
I was really keen for this idea but after writing out a solution it didn't make sense anymore. Just as $e->next_child() won't make sense because it's first_child not next_child unless it follows some iterator pattern perhaps. I'm really torn on this now.Maybe we should look at DomDocument or jQuery for examples?
I will see if I can roll us something like that
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You have a point there but I don't think next_sibling and prev_sibling should be changed, they are quite precise in what you'd expect from them.
That said I can see a use, in line with our $e->children($idx) I would imagine we would find useful a $e->siblings($idx) method but if you think about it that doesn't make sense either, right?
Why don't you use:
$e->parent()->children(6)->plaintext;
Instead which does exactly what you need, can already be done and has no ambiguity attached, do you agree?
I was really keen for this idea but after writing out a solution it didn't make sense anymore. Just as $e->next_child() won't make sense because it's first_child not next_child unless it follows some iterator pattern perhaps. I'm really torn on this now.Maybe we should look at DomDocument or jQuery for examples?
I will see if I can roll us something like that