From 3780e3cddb2416bb779521e251f46f61f3dbdbde Mon Sep 17 00:00:00 2001 From: Jay Potter Date: Sat, 21 Mar 2026 10:11:35 -0400 Subject: [PATCH] init --- composer.json | 12 +++++---- src/Potter/Aware/AwareInterface.php | 14 +++++++++++ src/Potter/Aware/AwareTrait.php | 30 +++++++++++++++++++++++ src/Potter/Template/TemplateInterface.php | 8 ------ src/Potter/Template/TemplateTrait.php | 8 ------ 5 files changed, 51 insertions(+), 21 deletions(-) create mode 100644 src/Potter/Aware/AwareInterface.php create mode 100644 src/Potter/Aware/AwareTrait.php delete mode 100644 src/Potter/Template/TemplateInterface.php delete mode 100644 src/Potter/Template/TemplateTrait.php diff --git a/composer.json b/composer.json index 88f10f4..83d00cd 100644 --- a/composer.json +++ b/composer.json @@ -1,9 +1,9 @@ { - "name": "potter/template", - "description": "Potter Framework Component Template", + "name": "potter/aware", + "description": "Potter Framework Aware Interface", "version": "1.0.0", "type": "library", - "homepage": "https://gitpotter.com/Potter/Template", + "homepage": "https://gitpotter.com/Potter/Aware", "license": "MIT", "authors": [ { @@ -14,11 +14,13 @@ ], "autoload": { "psr-4": { - "Potter\\Template\\": "src/Potter/Template/" + "Potter\\Aware\\": "src/Potter/Aware/" } }, "minimum-stability": "stable", "require": { - "php": "^8.3" + "php": "^8.3", + "potter/cloneable": "^1.0", + "potter/container": "^1.0" } } diff --git a/src/Potter/Aware/AwareInterface.php b/src/Potter/Aware/AwareInterface.php new file mode 100644 index 0000000..9c43f53 --- /dev/null +++ b/src/Potter/Aware/AwareInterface.php @@ -0,0 +1,14 @@ +clone(); + $clone->set($key, $value); + return $clone; + } + + final public function without(string $key): static + { + $clone = $this->clone(); + if (!$clone->has($key)) { + return $clone; + } + $clone->unset($key); + return $clone; + } + + abstract public function clone(): static; + abstract public function has(string $key): bool; + abstract protected function set(string $key, mixed $value): mixed; + abstract protected function unset(string $key): null; +} diff --git a/src/Potter/Template/TemplateInterface.php b/src/Potter/Template/TemplateInterface.php deleted file mode 100644 index c91046e..0000000 --- a/src/Potter/Template/TemplateInterface.php +++ /dev/null @@ -1,8 +0,0 @@ -