diff --git a/src/Potter/Aware/AbstractAware.php b/src/Potter/Aware/AbstractAware.php index c267858..4c76a0b 100644 --- a/src/Potter/Aware/AbstractAware.php +++ b/src/Potter/Aware/AbstractAware.php @@ -11,4 +11,5 @@ abstract class AbstractAware implements AwareInterface abstract protected function set(string $key, mixed $value): mixed; abstract protected function unset(string $key): void; abstract public function with(string $key, mixed $value): AwareInterface; + abstract public function without(string $key): AwareInterface; } diff --git a/src/Potter/Aware/AwareInterface.php b/src/Potter/Aware/AwareInterface.php index 1f5539f..2ffc9a5 100644 --- a/src/Potter/Aware/AwareInterface.php +++ b/src/Potter/Aware/AwareInterface.php @@ -9,4 +9,5 @@ interface AwareInterface public function get(string $key): mixed; public function has(string $key): bool; public function with(string $key, mixed $value): self; + public function without(string $key): self; } diff --git a/src/Potter/Aware/AwareTrait.php b/src/Potter/Aware/AwareTrait.php index 7ebbb79..b11ad50 100644 --- a/src/Potter/Aware/AwareTrait.php +++ b/src/Potter/Aware/AwareTrait.php @@ -37,4 +37,10 @@ trait AwareTrait ($clone = $this->clone())->set($key, $value); return $clone; } + + final public function without(string $key): AwareInterface + { + ($clone = $this->clone())->unset($key); + return $clone; + } }