blob: b3def28296c92c937619e9fe1afc7fa5acc1d405 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
<?php
namespace Digitigrade\Timeline;
abstract class Timeline {
// TODO: currently making this number up. probably should be modifiable somewhere
private const RESULTS_PER_PAGE = 50;
/**
* Gets a pageful of items to be included in the timeline
* @param int $page page number to return (0-indexed)
* @return TimelineItem[]
*/
public function getPage(int $page = 0): array {
return $this->getItems(self::RESULTS_PER_PAGE, self::RESULTS_PER_PAGE * $page);
}
/**
* Gets a selection of items to be included in the timeline
* @param int $limit max number of items to return
* @param int $offset number of items to skip at first
* @return TimelineItem[]
*/
abstract protected function getItems(int $limit, int $offset): array;
}
|