1 | <?php |
||
12 | class Cursor implements Arrayable |
||
13 | { |
||
14 | protected $after = null; |
||
15 | |||
16 | public function __construct($after = null) |
||
20 | |||
21 | /** |
||
22 | * @return bool |
||
23 | */ |
||
24 | public function isPresent() |
||
28 | |||
29 | /** |
||
30 | * @return bool |
||
31 | */ |
||
32 | public function hasAfter() |
||
36 | |||
37 | /** |
||
38 | * @return mixed |
||
39 | */ |
||
40 | public function getAfterCursor() |
||
44 | |||
45 | /** |
||
46 | * Decode cursor from query arguments. |
||
47 | * |
||
48 | * If no 'after' argument is provided or the contents are not a valid base64 string, |
||
49 | * this will return empty array. That will effectively reset pagination, so the user gets the |
||
50 | * first slice. |
||
51 | * |
||
52 | * @param array<string, mixed> $args |
||
53 | */ |
||
54 | public static function decode(?array $args): Cursor |
||
63 | |||
64 | /** |
||
65 | * Encode the given offset to make the implementation opaque. |
||
66 | */ |
||
67 | public static function encode(array $data): string |
||
71 | |||
72 | public function toArray() |
||
78 | } |
||
79 |