|
3 | 3 | namespace Illuminate\Support; |
4 | 4 |
|
5 | 5 | use Closure; |
| 6 | +use Illuminate\Support\Traits\Conditionable; |
6 | 7 | use Illuminate\Support\Traits\Macroable; |
7 | 8 | use Illuminate\Support\Traits\Tappable; |
8 | 9 | use JsonSerializable; |
9 | 10 | use Symfony\Component\VarDumper\VarDumper; |
10 | 11 |
|
11 | 12 | class Stringable implements JsonSerializable |
12 | 13 | { |
13 | | - use Macroable, Tappable; |
| 14 | + use Conditionable, Macroable, Tappable; |
14 | 15 |
|
15 | 16 | /** |
16 | 17 | * The underlying string value. |
@@ -708,38 +709,6 @@ public function ucfirst() |
708 | 709 | return new static(Str::ucfirst($this->value)); |
709 | 710 | } |
710 | 711 |
|
711 | | - /** |
712 | | - * Apply the callback's string changes if the given "value" is false. |
713 | | - * |
714 | | - * @param mixed $value |
715 | | - * @param callable $callback |
716 | | - * @param callable|null $default |
717 | | - * @return mixed|$this |
718 | | - */ |
719 | | - public function unless($value, $callback, $default = null) |
720 | | - { |
721 | | - return $this->when(! $value, $callback, $default); |
722 | | - } |
723 | | - |
724 | | - /** |
725 | | - * Apply the callback's string changes if the given "value" is true. |
726 | | - * |
727 | | - * @param mixed $value |
728 | | - * @param callable $callback |
729 | | - * @param callable|null $default |
730 | | - * @return mixed|$this |
731 | | - */ |
732 | | - public function when($value, $callback, $default = null) |
733 | | - { |
734 | | - if ($value) { |
735 | | - return $callback($this, $value) ?: $this; |
736 | | - } elseif ($default) { |
737 | | - return $default($this, $value) ?: $this; |
738 | | - } |
739 | | - |
740 | | - return $this; |
741 | | - } |
742 | | - |
743 | 712 | /** |
744 | 713 | * Execute the given callback if the string is empty. |
745 | 714 | * |
|
0 commit comments