diff --git a/src/Potter/Nameable/NameableTrait.php b/src/Potter/Nameable/NameableTrait.php index 4305c82..0119677 100644 --- a/src/Potter/Nameable/NameableTrait.php +++ b/src/Potter/Nameable/NameableTrait.php @@ -11,9 +11,44 @@ trait NameableTrait private const string NAME = 'name'; abstract public function get(string $key): mixed; + + final public function getName(): string + { + return $this->get(self::NAME); + } + abstract public function has(string $key): bool; + + final public function hasName(): bool + { + return $this->has(self::NAME); + } + abstract protected function set(string $key, mixed $value): mixed; + + final protected function setName(string $name): string + { + return $this->set(self::NAME, $name); + } + abstract protected function unset(string $key): void; + + final protected function unsetName(): void + { + $this->unset(self::NAME); + } + abstract public function with(string $key, mixed $value): AwareInterface; + + final public function withName(string $name): NameableInterface + { + return $this->with(self::NAME, $name); + } + abstract public function without(string $key): AwareInterface; + + final public function withoutName(): NameableInterface + { + return $this->without(self::NAME); + } }