You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Added a couple of functions to the [Collection](./src/Domain/Collection.php) class to enable a smoother developer experience when trying use it in a more functional style
8
+
9
+
The following functions were added:
10
+
*`fromIterable` - enables users of the collection to construction the collection from an iterable value like iterators, generators, etc.
11
+
*`every` - Function that returns true if given callback returns truthy values for all items
12
+
*`none` - Function that returns true if given callback returns falsy values for all items
13
+
*`some` - Function that returns true if given callback returns truthy values on some items
14
+
*`first` - Get the first element of the collection that matches a callback, if given. Throws exception if collection is empty or predicate is never satisfied
15
+
*`firstOr` - Same as first but returns $fallbackValue if collection is empty or predicate is never satisfied
16
+
*`last` - Get the last element of the collection that matches a callback, if given. Throws exception if collection is empty or predicate is never satisfied
17
+
*`lastOr` - Same as last but returns $fallbackValue if collection is empty or predicate is never satisfied
0 commit comments