Athari / YaLinqo

Yet Another LINQ to Objects for PHP [Simplified BSD]
https://athari.github.io/YaLinqo
BSD 2-Clause "Simplified" License
441 stars 39 forks source link

Enumerable::from throws InvalidArgumentException on SimpleXMLElement #13

Closed MatkovIvan closed 8 years ago

MatkovIvan commented 8 years ago

When I tried call Enumerable::from on SimpleXMLElement throws

InvalidArgumentException: source must be array or Traversable or Enumerable.

But class SimpleXMLElement implements Traversable.

Athari commented 8 years ago

Should work now. Please note that SimpleXMLElement returns element names as keys, so some transformations may return unexpected results, for example, a call to toArray will return just last elements of each name if multiple elements with the same name are present, because keys will collapse (toList can be used in this case to avoid the problem).