@@ -36,14 +36,14 @@ class CursorPaginator extends Paginator
3636 *
3737 * @var string
3838 */
39- protected string $ nextPageKey = 'next_page_url ' ;
39+ protected string $ nextPageKeyName = 'next_page_url ' ;
4040
4141 /**
4242 * The key/query parameter that contains the cursor
4343 *
4444 * @var string
4545 */
46- protected string $ cursorKey = 'cursor ' ;
46+ protected string $ cursorKeyName = 'cursor ' ;
4747
4848 /**
4949 * Constructor
@@ -99,7 +99,7 @@ protected function applyPagination(Request $request): void
9999 $ request ->query ()->add ($ this ->getLimitKeyName (), $ this ->limit ());
100100 }
101101
102- $ request ->query ()->add ($ this ->getCursorKey (), $ this ->currentCursor );
102+ $ request ->query ()->add ($ this ->getCursorKeyName (), $ this ->currentCursor );
103103 }
104104
105105 /**
@@ -114,7 +114,7 @@ protected function isFinished(): bool
114114 return $ this ->currentPage > $ this ->totalPages ();
115115 }
116116
117- return is_null ($ this ->currentResponse ->json ($ this ->getNextPageKey ()));
117+ return is_null ($ this ->currentResponse ->json ($ this ->getNextPageKeyName ()));
118118 }
119119
120120 /**
@@ -135,41 +135,41 @@ public function key(): string|int
135135 */
136136 protected function getCursor (): string |int |null
137137 {
138- $ rawQuery = parse_url ($ this ->currentResponse ->json ($ this ->getNextPageKey ()) ?? '' , PHP_URL_QUERY );
138+ $ rawQuery = parse_url ($ this ->currentResponse ->json ($ this ->getNextPageKeyName ()) ?? '' , PHP_URL_QUERY );
139139
140140 if (empty ($ rawQuery )) {
141141 return null ;
142142 }
143143
144144 parse_str ($ rawQuery , $ query );
145145
146- $ cursorValue = $ query [$ this ->getCursorKey ()] ?? null ;
146+ $ cursorValue = $ query [$ this ->getCursorKeyName ()] ?? null ;
147147
148148 return is_array ($ cursorValue ) ? $ cursorValue [0 ] : $ cursorValue ;
149149 }
150150
151151 /**
152152 * Set the JSON key for the next page URL that contains the cursor
153153 *
154- * @param string $nextPageKey
154+ * @param string $nextPageKeyName
155155 * @return $this
156156 */
157- public function setNextPageKey (string $ nextPageKey ): static
157+ public function setNextPageKeyName (string $ nextPageKeyName ): static
158158 {
159- $ this ->nextPageKey = $ nextPageKey ;
159+ $ this ->nextPageKeyName = $ nextPageKeyName ;
160160
161161 return $ this ;
162162 }
163163
164164 /**
165165 * Set the key/query parameter that contains the cursor
166166 *
167- * @param string $cursorKey
167+ * @param string $cursorKeyName
168168 * @return $this
169169 */
170- public function setCursorKey (string $ cursorKey ): static
170+ public function setCursorKeyName (string $ cursorKeyName ): static
171171 {
172- $ this ->cursorKey = $ cursorKey ;
172+ $ this ->cursorKeyName = $ cursorKeyName ;
173173
174174 return $ this ;
175175 }
@@ -179,18 +179,18 @@ public function setCursorKey(string $cursorKey): static
179179 *
180180 * @return string
181181 */
182- public function getNextPageKey (): string
182+ public function getNextPageKeyName (): string
183183 {
184- return $ this ->nextPageKey ;
184+ return $ this ->nextPageKeyName ;
185185 }
186186
187187 /**
188188 * Get the cursor key
189189 *
190190 * @return string
191191 */
192- public function getCursorKey (): string
192+ public function getCursorKeyName (): string
193193 {
194- return $ this ->cursorKey ;
194+ return $ this ->cursorKeyName ;
195195 }
196196}
0 commit comments