Skip to content

Commit

Permalink
[11.x] Add Dumpable trait to Uri (#53960)
Browse files Browse the repository at this point in the history
* add dumpable trait to Uri

* dump/dd only the string representation of the URI

* Update Uri.php

---------

Co-authored-by: Taylor Otwell <[email protected]>
  • Loading branch information
nuernbergerA and taylorotwell authored Dec 18, 2024
1 parent 1f73ec9 commit 502b489
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/Illuminate/Support/Uri.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Illuminate\Contracts\Support\Responsable;
use Illuminate\Http\RedirectResponse;
use Illuminate\Support\Traits\Conditionable;
use Illuminate\Support\Traits\Dumpable;
use Illuminate\Support\Traits\Tappable;
use League\Uri\Contracts\UriInterface;
use League\Uri\Uri as LeagueUri;
Expand All @@ -16,7 +17,7 @@

class Uri implements Htmlable, Responsable, Stringable
{
use Conditionable, Tappable;
use Conditionable, Dumpable, Tappable;

/**
* The URI instance.
Expand Down Expand Up @@ -351,6 +352,19 @@ public function isEmpty(): bool
return trim($this->value()) === '';
}

/**
* Dump the string representation of the URI.
*
* @param mixed ...$args
* @return $this
*/
public function dump(...$args)
{
dump($this->value(), ...$args);

return $this;
}

/**
* Set the URL generator resolver.
*/
Expand Down

0 comments on commit 502b489

Please sign in to comment.