From 1f685e7674ca6bdaef703761d8fecf976e65fa8f Mon Sep 17 00:00:00 2001 From: Jay Potter Date: Sat, 21 Mar 2026 09:53:59 -0400 Subject: [PATCH] initialize --- .gitignore | 2 +- README.md | 2 +- composer.json | 5 +++-- src/Potter/Container/ContainerInterface.php | 13 +++++++++++ src/Potter/Container/ContainerTrait.php | 25 +++++++++++++++++++++ 5 files changed, 43 insertions(+), 4 deletions(-) create mode 100644 src/Potter/Container/ContainerInterface.php create mode 100644 src/Potter/Container/ContainerTrait.php diff --git a/.gitignore b/.gitignore index df8b2d5..c7ce00a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ composer.lock composer.phar -/nbproject/private/ +/nbproject/ /vendor/ \ No newline at end of file diff --git a/README.md b/README.md index 3f7e501..6bbb63f 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,3 @@ -# Potter Framework PSR-11 Container Implementation +# Potter Framework Container Interface Hello World \ No newline at end of file diff --git a/composer.json b/composer.json index 76f4bf9..2ba9a0b 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "potter/container", - "description": "Potter Framework PSR-11 Container Implementation", + "description": "Potter Framework Container Interface", "version": "1.0.0", "type": "library", "homepage": "https://gitpotter.com/Potter/Container", @@ -19,6 +19,7 @@ }, "minimum-stability": "stable", "require": { - "php": "^8.3" + "php": "^8.3", + "psr/container": "^2.0" } } diff --git a/src/Potter/Container/ContainerInterface.php b/src/Potter/Container/ContainerInterface.php new file mode 100644 index 0000000..0c186ed --- /dev/null +++ b/src/Potter/Container/ContainerInterface.php @@ -0,0 +1,13 @@ +storage[$key]; + } + + final public function has(string $key): bool + { + return array_key_exists($key, $this->storage) && !is_null($this->storage[$key]); + } + + final protected function set(string $key, mixed $value): mixed + { + return $this->storage[$key] = $value; + } +}