aboutsummaryrefslogtreecommitdiffhomepage
path: root/Digitigrade/Timeline/Timeline.php
diff options
context:
space:
mode:
Diffstat (limited to 'Digitigrade/Timeline/Timeline.php')
-rw-r--r--Digitigrade/Timeline/Timeline.php24
1 files changed, 24 insertions, 0 deletions
diff --git a/Digitigrade/Timeline/Timeline.php b/Digitigrade/Timeline/Timeline.php
new file mode 100644
index 0000000..b3def28
--- /dev/null
+++ b/Digitigrade/Timeline/Timeline.php
@@ -0,0 +1,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;
+} \ No newline at end of file