generated from Potter/Http-Server-Aware
init
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
{
|
||||
"name": "potter/socket-server-aware",
|
||||
"description": "Potter Framework HTTP Server Aware Interface",
|
||||
"description": "Potter Framework Socket Server Aware Interface",
|
||||
"version": "1.0.0",
|
||||
"type": "library",
|
||||
"homepage": "https://gitpotter.com/Potter/HTTP-Server-Aware",
|
||||
"homepage": "https://gitpotter.com/Potter/Socket-Server-Aware",
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
@@ -14,13 +14,13 @@
|
||||
],
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Potter\\Http\\Server\\": "src/Potter/Http/Server/"
|
||||
"Potter\\Socket\\Server\\": "src/Potter/Socket/Server/"
|
||||
}
|
||||
},
|
||||
"minimum-stability": "stable",
|
||||
"require": {
|
||||
"php": "^8.3",
|
||||
"potter/aware": "^1.0",
|
||||
"react/http": "^1.11"
|
||||
"react/socket": "^1.17"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Potter\Http\Server;
|
||||
|
||||
use \Potter\Aware\AwareInterface;
|
||||
use \React\Http\HttpServer;
|
||||
|
||||
interface HttpServerAwareInterface extends AwareInterface
|
||||
{
|
||||
public function getHttpServer(): HttpServer;
|
||||
public function hasHttpServer(): bool;
|
||||
public function withHttpServer(HttpServer $httpServer): static;
|
||||
public function withoutHttpServer(): static;
|
||||
}
|
||||
16
src/Potter/Socket/Server/SocketServerAwareInterface.php
Normal file
16
src/Potter/Socket/Server/SocketServerAwareInterface.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Potter\Socket\Server;
|
||||
|
||||
use \Potter\Aware\AwareInterface;
|
||||
use \React\Socket\SocketServer;
|
||||
|
||||
interface SocketServerAwareInterface extends AwareInterface
|
||||
{
|
||||
public function getSocketServer(): SocketServer;
|
||||
public function hasSocketServer(): bool;
|
||||
public function withSocketServer(SocketServer $socketServer): static;
|
||||
public function withoutSocketServer(): static;
|
||||
}
|
||||
@@ -2,40 +2,40 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Potter\Http\Server;
|
||||
namespace Potter\Socket\Server;
|
||||
|
||||
use \React\Http\HttpServer;
|
||||
use \React\Socket\SocketServer;
|
||||
|
||||
trait HttpServerAwareTrait
|
||||
trait SocketServerAwareTrait
|
||||
{
|
||||
private const string HTTP_SERVER = 'httpServer';
|
||||
private const string HTTP_SERVER = 'socketServer';
|
||||
|
||||
final public function getHttpServer(): HttpServer
|
||||
final public function getSocketServer(): SocketServer
|
||||
{
|
||||
return $this->get(self::HTTP_SERVER);
|
||||
}
|
||||
|
||||
final public function hasHttpServer(): bool
|
||||
final public function hasSocketServer(): bool
|
||||
{
|
||||
return $this->has(self::HTTP_SERVER);
|
||||
}
|
||||
|
||||
final protected function setHttpServer(HttpServer $httpServer): HttpServer
|
||||
final protected function setSocketServer(SocketServer $socketServer): SocketServer
|
||||
{
|
||||
return $this->set(self::HTTP_SERVER, $httpServer);
|
||||
return $this->set(self::HTTP_SERVER, $socketServer);
|
||||
}
|
||||
|
||||
final protected function unsetHttpServer(): null
|
||||
final protected function unsetSocketServer(): null
|
||||
{
|
||||
return $this->unset(self::HTTP_SERVER);
|
||||
}
|
||||
|
||||
final public function withHttpServer(HttpServer $httpServer): static
|
||||
final public function withSocketServer(SocketServer $socketServer): static
|
||||
{
|
||||
return $this->with(self::HTTP_SERVER, $httpServer);
|
||||
return $this->with(self::HTTP_SERVER, $socketServer);
|
||||
}
|
||||
|
||||
final public function withoutHttpServer(): static
|
||||
final public function withoutSocketServer(): static
|
||||
{
|
||||
return $this->without(self::HTTP_SERVER);
|
||||
}
|
||||
Reference in New Issue
Block a user