aboutsummaryrefslogtreecommitdiffhomepage
path: root/Digitigrade/Timeline.php
diff options
context:
space:
mode:
authorwinter2024-12-31 16:25:22 +0000
committerwinter2024-12-31 16:25:22 +0000
commit982e6213622bcb78a40d17f54cda27225a1d84b3 (patch)
tree0a81d8fc183238dca959a4ab848c9cd1d241ef27 /Digitigrade/Timeline.php
parentad554b48e7dc355d9b33eede98f4e3e829fd867e (diff)
rework timelines. inclusion reasons supported now
Diffstat (limited to 'Digitigrade/Timeline.php')
-rw-r--r--Digitigrade/Timeline.php25
1 files changed, 11 insertions, 14 deletions
diff --git a/Digitigrade/Timeline.php b/Digitigrade/Timeline.php
index 67708ab..64aabe1 100644
--- a/Digitigrade/Timeline.php
+++ b/Digitigrade/Timeline.php
@@ -8,22 +8,19 @@ abstract class Timeline {
private const RESULTS_PER_PAGE = 50;
/**
- * Gets a pageful of note IDs to be included in this timeline
- * @param int $limit maximum number of results to return
- * @param int $offset number of results to skip (i.e. results from previous pages)
- * @return int[]
+ * Gets a pageful of items to be included in the timeline
+ * @param int $page page number to return (0-indexed)
+ * @return TimelineItem[]
*/
- protected abstract function getNoteIds(int $limit, int $offset): array;
+ public function getPage(int $page = 0): array {
+ return $this->getItems(self::RESULTS_PER_PAGE, self::RESULTS_PER_PAGE * $page);
+ }
/**
- * Gets a pageful of notes that are included in this timeline
- * @param int $page page number to return (0-indexed)
- * @return Note[]
+ * 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[]
*/
- public function getNotes(int $page = 0): array {
- $ids = $this->getNoteIds(self::RESULTS_PER_PAGE, self::RESULTS_PER_PAGE * $page);
- return array_map(function (int $id) {
- return Note::find($id);
- }, $ids);
- }
+ abstract protected function getItems(int $limit, int $offset): array;
} \ No newline at end of file