/** * get any number of pastes from a bin, ordered by date, narrowed by limit and offset * @param string $bin A paste bin to query * @param integer $limit a maximum of pastes to retrieve (optional, default to null = all) * @param integer start a number of pastes to skip before retrieving (optional, default to null = begin with first) * @return array a list of pastes */ public function getPastes($bin, $limit = null, $start = null) { $pm = $this->_mappers->create('Pastie_Entity_PasteMapper'); $query = new Horde_Rdo_Query($pm); $query->sortBy('paste_timestamp DESC'); if ($limit !== null) { if ($start === null) { $start = 0; } $query->limit($limit, $start); } $pastes = array(); foreach ($pm->find($query) as $paste) { $pastes[$paste['paste_uuid']] = $this->_fromBackend($paste); } return $pastes; }