News for hackers. Stuff that matters.
Re:PHP CommonMark by _RPM on Thursday December 25, 2014 @04:27PM (#8797253)
https://github.com/thephpleague/commonmark/blob/master/src/U... What is the Point of abstracting away "empty?"
Re:PHP CommonMark by alexbilbie on Thursday December 25, 2014 @05:08PM (#8797331)
I guess because you're asking a question of the object - "is this empty?"
Re:PHP CommonMark by Rygu on Thursday December 25, 2014 @06:07PM (#8797455)
It already implements count() and the corresponding interface so it's possible to write count($collection) as if you're writing $collection->count(). It's a valid question why this type of object needs two methods for checking the same property.
Re:PHP CommonMark by hrtyl on Friday December 26, 2014 @04:14AM (#8798510)
PHP does not have an interface for empty. count and empty are not equivalent. empty should be called on the underlying array and not the object.