commit ca211b6894a3205da9849979249d1742d6309438 Author: Potter <> Date: Sat Mar 21 15:34:14 2026 +0000 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c7ce00a --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +composer.lock +composer.phar +/nbproject/ +/vendor/ \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..b83d281 --- /dev/null +++ b/LICENSE @@ -0,0 +1,18 @@ +MIT License + +Copyright (c) 2026 Jay Potter + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the +following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial +portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT +LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO +EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..e167857 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# Potter Framework HTTP Server Aware Interface + +Hello World \ No newline at end of file diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..4858d4a --- /dev/null +++ b/composer.json @@ -0,0 +1,26 @@ +{ + "name": "potter/http-server-aware", + "description": "Potter Framework HTTP Server Aware Interface", + "version": "1.0.0", + "type": "library", + "homepage": "https://gitpotter.com/Potter/HTTP-Server-Aware", + "license": "MIT", + "authors": [ + { + "name": "Jay Potter", + "email": "j@ypotter.ca", + "homepage": "https://gitpotter.com/" + } + ], + "autoload": { + "psr-4": { + "Potter\\Http\\Server\\": "src/Potter/Http/Server/" + } + }, + "minimum-stability": "stable", + "require": { + "php": "^8.3", + "potter/aware": "^1.0", + "react/http": "^1.11" + } +} diff --git a/src/Potter/Http/Server/HttpServerAwareInterface.php b/src/Potter/Http/Server/HttpServerAwareInterface.php new file mode 100644 index 0000000..be68c8a --- /dev/null +++ b/src/Potter/Http/Server/HttpServerAwareInterface.php @@ -0,0 +1,16 @@ +get(self::HTTP_SERVER); + } + + final public function hasHttpServer(): bool + { + return $this->has(self::HTTP_SERVER); + } + + final protected function setHttpServer(HttpServer $httpServer): HttpServer + { + return $this->set(self::HTTP_SERVER, $httpServer); + } + + final protected function unsetHttpServer(): null + { + return $this->unset(self::HTTP_SERVER); + } + + final public function withHttpServer(HttpServer $httpServer): static + { + return $this->with(self::HTTP_SERVER, $httpServer); + } + + final public function withoutHttpServer(): static + { + return $this->without(self::HTTP_SERVER); + } + + abstract public function get(string $key): mixed; + abstract public function has(string $key): mixed; + abstract protected function set(string $key, mixed $value): mixed; + abstract protected function unset(string $key): null; + abstract public function with(string $key, mixed $value): static; + abstract public function without(string $key): static; +}