phpcr / phpcr-shell

PHPCR Shell
MIT License
69 stars 19 forks source link

Renamed array_set to array_replace_at #108

Closed dantleech closed 9 years ago

dantleech commented 9 years ago

//cc @dbu

dantleech commented 9 years ago

I am not sure about this: array_replace_at implies that the index must exist. Would it ever be a valid case to set a non-existing index? I guess not, but if it were valid then array_set would be a better name,

dbu commented 9 years ago

as phpcr arrays are consequitive arrays and not hashmaps, you can't set a new index. we could allow the edge case of hitting the spot after the last element and in this case add the element. or in general say that if the index is higher than the last, it actually appends. this is probably better than doing an error in that case.