groupBy() public method

Groups the elements of an observable sequence according to a specified key selector function and comparer and selects the resulting elements by using a specified function.
public groupBy ( callable $keySelector, callable $elementSelector = null, callable $keySerializer = null ) : Rx\Observable\AnonymousObservable
$keySelector callable
$elementSelector callable
$keySerializer callable
return Rx\Observable\AnonymousObservable
 /**
  * @param Observable $observable
  * @return Observable\AnonymousObservable
  */
 public function summarize(Observable $observable)
 {
     return $observable->groupBy(function (FileWithDate $file) {
         return $file->getDatePath();
     }, function (FileWithDate $file) {
         return $file->getDatePath();
     }, function ($key) {
         return $key;
     })->flatMap(function (GroupedObservable $g) {
         return $g->zip([$g->distinct(), $g->count()], function ($_, $b, $c) {
             return "Created {$b} with {$c} files";
         });
     });
 }