public function breakGroup($key,$func)
    {
        $data = array();
        $start = 0;
        foreach ($this->rows as $i=>$row) {
            if (!isset($oldValue)) {
                $oldValue = $row[$key];
            }

            if ($row[$key]==$oldValue) {
                $oldValue = $row[$key];
                array_push($data, $row);
            } else {
                $func(new DataStore($data, $this->metaData), $start);
                $start = $i;
                $data = array($row);
                $oldValue = $row[$key];
            }
        }
        $func(new DataStore($data, $this->metaData), $start);
    }
public function breakGroup($key,$func)
    {
        $data = array();
        $start = 0;
        foreach ($this->rows as $i=>$row) {
            if (!isset($oldValue)) {
                $oldValue = $row[$key];
            }

            if ($row[$key]==$oldValue) {
                $oldValue = $row[$key];
                array_push($data, $row);
            } else {
                $func(new DataStore($data, $this->metaData), $start);
                $start = $i;
                $data = array($row);
                $oldValue = $row[$key];
            }
        }
        $func(new DataStore($data, $this->metaData), $start);
    }
public function breakGroup ( $ key , $ func ) { $ data = array ( ) ; $ start = 0 ; foreach ( $ this -> rows as $ i => $ row ) { if ( ! isset ( $ oldValue ) ) { $ oldValue = $ row [ $ key ] ; } if ( $ row [ $ key ] == $ oldValue ) { $ oldValue = $ row [ $ key ] ; array_push ( $ data , $ row ) ; } else { $ func ( new DataStore ( $ data , $ this -> metaData ) , $ start ) ; $ start = $ i ; $ data = array ( $ row ) ; $ oldValue = $ row [ $ key ] ; } } $ func ( new DataStore ( $ data , $ this -> metaData ) , $ start ) ; }
Break datastore into smaller group by specific column value

@param string   $key  The key column used to break datastore into groups
@param function $func Anonymous function to be called when a group is form

@return null
Break datastore into smaller group by specific column value