function groupBy($column) {
        if($column === null || $column === '') {
            return $this;
        }
        
        $new = array();
        foreach($this->data as $key => $val) {
            if(\is_callable($column)) {
                $key = $column($val, $key);
            } elseif(\is_array($val)) {
                $key = $val[$column];
            } elseif(\is_object($val)) {
                $key = $val->$column;
            }
            
            $new[$key][] = $val;
        }
        
        return (new self($new));
    }
function groupBy($column) {
        if($column === null || $column === '') {
            return $this;
        }
        
        $new = array();
        foreach($this->data as $key => $val) {
            if(\is_callable($column)) {
                $key = $column($val, $key);
            } elseif(\is_array($val)) {
                $key = $val[$column];
            } elseif(\is_object($val)) {
                $key = $val->$column;
            }
            
            $new[$key][] = $val;
        }
        
        return (new self($new));
    }
function groupBy ( $ column ) { if ( $ column === null || $ column === '' ) { return $ this ; } $ new = array ( ) ; foreach ( $ this -> data as $ key => $ val ) { if ( \ is_callable ( $ column ) ) { $ key = $ column ( $ val , $ key ) ; } elseif ( \ is_array ( $ val ) ) { $ key = $ val [ $ column ] ; } elseif ( \ is_object ( $ val ) ) { $ key = $ val -> $ column ; } $ new [ $ key ] [ ] = $ val ; } return ( new self ( $ new ) ) ; }
Groups the collection's items by a given key. Returns a new Collection.
@param callable|mixed  $column  Callback specification: `function ($value, $key): mixed`
@return \CharlotteDunois\Collect\Collection
Groups the collection s items by a given key . Returns a new Collection .