Skip to content

Commit 889b43a

Browse files
committed
feature #21138 [BrowserKit] Add isFirstPage() and isLastPage() methods to History (santysisi)
This PR was merged into the 7.4 branch. Discussion ---------- [BrowserKit] Add `isFirstPage()` and `isLastPage()` methods to History This updates the `BrowserKit` documentation to demonstrate how to use the `isFirstPage` and `isLastPage` methods of the History class. Commits ------- 9d67f32 [BrowserKit] Add `isFirstPage()` and `isLastPage()` methods to History
2 parents 74a1a5f + 9d67f32 commit 889b43a

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

components/browser_kit.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,20 @@ history::
329329
// go forward to documentation page
330330
$crawler = $client->forward();
331331

332+
// check if the history position is on the first page
333+
if (!$client->getHistory()->isFirstPage()) {
334+
$crawler = $client->back();
335+
}
336+
337+
// check if the history position is on the last page
338+
if (!$client->getHistory()->isLastPage()) {
339+
$crawler = $client->forward();
340+
}
341+
342+
.. versionadded:: 7.4
343+
344+
The ``isFirstPage`` and ``isLastPage`` methods were introduced in Symfony 7.4.
345+
332346
You can delete the client's history with the ``restart()`` method. This will
333347
also delete all the cookies::
334348

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy