From 7fb8f9eca6d53bc0fdeee7e08a95ae702748feca Mon Sep 17 00:00:00 2001 From: Richard Browne Date: Tue, 16 Sep 2025 23:43:15 +0100 Subject: [PATCH] Implement tap method for instance manipulation --- src/Api/Webpage.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Api/Webpage.php b/src/Api/Webpage.php index d42876a7..6877e16e 100644 --- a/src/Api/Webpage.php +++ b/src/Api/Webpage.php @@ -95,6 +95,16 @@ public function value(string $selector): string return $this->guessLocator($selector)->inputValue(); } + /** + * Call the given Closure with this instance then return the instance. + **/ + public function tap(callable $callback): self + { + $callback($this); + + return $this; + } + /** * Gets the locator for the given selector. */