Paginator.php
111 lines
| 1 | <?php |
| 2 | |
| 3 | namespace IAWPSCOPED\Illuminate\Contracts\Pagination; |
| 4 | |
| 5 | /** @internal */ |
| 6 | interface Paginator |
| 7 | { |
| 8 | /** |
| 9 | * Get the URL for a given page. |
| 10 | * |
| 11 | * @param int $page |
| 12 | * @return string |
| 13 | */ |
| 14 | public function url($page); |
| 15 | /** |
| 16 | * Add a set of query string values to the paginator. |
| 17 | * |
| 18 | * @param array|string|null $key |
| 19 | * @param string|null $value |
| 20 | * @return $this |
| 21 | */ |
| 22 | public function appends($key, $value = null); |
| 23 | /** |
| 24 | * Get / set the URL fragment to be appended to URLs. |
| 25 | * |
| 26 | * @param string|null $fragment |
| 27 | * @return $this|string|null |
| 28 | */ |
| 29 | public function fragment($fragment = null); |
| 30 | /** |
| 31 | * The URL for the next page, or null. |
| 32 | * |
| 33 | * @return string|null |
| 34 | */ |
| 35 | public function nextPageUrl(); |
| 36 | /** |
| 37 | * Get the URL for the previous page, or null. |
| 38 | * |
| 39 | * @return string|null |
| 40 | */ |
| 41 | public function previousPageUrl(); |
| 42 | /** |
| 43 | * Get all of the items being paginated. |
| 44 | * |
| 45 | * @return array |
| 46 | */ |
| 47 | public function items(); |
| 48 | /** |
| 49 | * Get the "index" of the first item being paginated. |
| 50 | * |
| 51 | * @return int |
| 52 | */ |
| 53 | public function firstItem(); |
| 54 | /** |
| 55 | * Get the "index" of the last item being paginated. |
| 56 | * |
| 57 | * @return int |
| 58 | */ |
| 59 | public function lastItem(); |
| 60 | /** |
| 61 | * Determine how many items are being shown per page. |
| 62 | * |
| 63 | * @return int |
| 64 | */ |
| 65 | public function perPage(); |
| 66 | /** |
| 67 | * Determine the current page being paginated. |
| 68 | * |
| 69 | * @return int |
| 70 | */ |
| 71 | public function currentPage(); |
| 72 | /** |
| 73 | * Determine if there are enough items to split into multiple pages. |
| 74 | * |
| 75 | * @return bool |
| 76 | */ |
| 77 | public function hasPages(); |
| 78 | /** |
| 79 | * Determine if there are more items in the data store. |
| 80 | * |
| 81 | * @return bool |
| 82 | */ |
| 83 | public function hasMorePages(); |
| 84 | /** |
| 85 | * Get the base path for paginator generated URLs. |
| 86 | * |
| 87 | * @return string|null |
| 88 | */ |
| 89 | public function path(); |
| 90 | /** |
| 91 | * Determine if the list of items is empty or not. |
| 92 | * |
| 93 | * @return bool |
| 94 | */ |
| 95 | public function isEmpty(); |
| 96 | /** |
| 97 | * Determine if the list of items is not empty. |
| 98 | * |
| 99 | * @return bool |
| 100 | */ |
| 101 | public function isNotEmpty(); |
| 102 | /** |
| 103 | * Render the paginator using a given view. |
| 104 | * |
| 105 | * @param string|null $view |
| 106 | * @param array $data |
| 107 | * @return string |
| 108 | */ |
| 109 | public function render($view = null, $data = []); |
| 110 | } |
| 111 |