generated from Potter/Template
init
This commit is contained in:
@@ -11,4 +11,6 @@ interface HttpServerAwareInterface extends AwareInterface
|
||||
{
|
||||
public function getHttpServer(): HttpServer;
|
||||
public function hasHttpServer(): bool;
|
||||
public function withHttpServer(HttpServer $httpServer): static;
|
||||
public function withoutHttpServer(): static;
|
||||
}
|
||||
|
||||
@@ -4,11 +4,41 @@ declare(strict_types=1);
|
||||
|
||||
namespace Potter\Http\Server;
|
||||
|
||||
use \React\Http\HttpServer;
|
||||
|
||||
trait HttpServerAwareTrait
|
||||
{
|
||||
private const string HTTP_SERVER = 'httpServer';
|
||||
|
||||
final public function getHttpServer(): HttpServer;
|
||||
final public function hasHttpServer(): bool;
|
||||
final protected function setHttpServer(HttpServer $httpServer): HttpServer;
|
||||
final public function getHttpServer(): HttpServer
|
||||
{
|
||||
return $this->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 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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user