original_string: public function mapToGroups(callable $callback)
      {
          $groups = $this->map($callback)->reduce(function ($groups, $pair) {
              $groups[key($pair)][] = reset($pair);
  
              return $groups;
          }, []);
  
          return (new static($groups))->map([$this, 'make']);
      }
code: public function mapToGroups(callable $callback)
      {
          $groups = $this->map($callback)->reduce(function ($groups, $pair) {
              $groups[key($pair)][] = reset($pair);
  
              return $groups;
          }, []);
  
          return (new static($groups))->map([$this, 'make']);
      }
code_tokens: public function mapToGroups ( callable $ callback ) { $ groups = $ this -> map ( $ callback ) -> reduce ( function ( $ groups , $ pair ) { $ groups [ key ( $ pair ) ] [ ] = reset ( $ pair ) ; return $ groups ; } , [ ] ) ; return ( new static ( $ groups ) ) -> map ( [ $ this , 'make' ] ) ; }
docstring: Run a grouping map over the items.
  
  The callback should return an associative array with a single key/value pair.
  
  @param callable $callback
  
  @return static
docstring_tokens: Run a grouping map over the items .