aboutsummaryrefslogtreecommitdiffhomepage
path: root/Digitigrade/Timeline.php
blob: 64aabe1693b8fd08e96e54e420dbc474148b29c7 (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
25
26
<?php
namespace Digitigrade;

use Digitigrade\Model\Note;

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;
}