/** * Takes a slice of messages according to limit and offset given * in option at initialisation time. Calls the callback to provide * information how much messages there is. */ protected function doPaging() { $total = count($this->collection); $offsets = $this->collection->slice($this->options['offset'], $this->options['limit']); $left = count($this->collection); $this->offsets = array('backwardsOffset' => $offsets[0], 'forwardsOffset' => $offsets[1], 'start' => $offsets[2], 'count' => $left, 'total' => $total); }