Skip to content

More collection functions, CollectionTrait and bugfixes

Compare
Choose a tag to compare
@DusanKasan DusanKasan released this 27 Apr 20:56
· 106 commits to master since this release

There are some new functions, specifically:

  • second() // seems useless but really usefull :)
  • combine($values) // uses current collection as keys, $values as values
  • except($keys) // rejects every item with key found in $keys
  • only($keys) // filters only items with key found in $keys
  • difference(...$collections) // filters items that are in the original collection but not in any of $collections
  • flip() // flips keys with values
  • has($key) // checks for the existence of item with $key key

CollectionTrait has been introduced and its usage documented in readme.

A handful of bugfixes also:

  • Collection constructor might have experienced conflicts between callable (in array form) and array arguments
  • Pluck might have failed on heterogenous collections. Now ignores non-collection items.