From 97ff5014b3f24e18128e593a4c71d29b5bb22772 Mon Sep 17 00:00:00 2001 From: Joe Dixon Date: Sun, 26 Nov 2023 14:56:22 +0000 Subject: [PATCH] wip --- src/Http/Request.php | 3 +++ src/Http/Router.php | 6 ++++++ src/Http/Server.php | 6 ++++-- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/Http/Request.php b/src/Http/Request.php index fd2b6077..a462e1ce 100644 --- a/src/Http/Request.php +++ b/src/Http/Request.php @@ -22,6 +22,9 @@ class Request */ const MAX_SIZE = 4096; + /** + * Turn the raw message into a Psr7 request. + */ public static function from(string $message, Connection $connection): ?RequestInterface { $connection->appendToBuffer($message); diff --git a/src/Http/Router.php b/src/Http/Router.php index 31f26210..679c7a0d 100644 --- a/src/Http/Router.php +++ b/src/Http/Router.php @@ -20,6 +20,11 @@ class Router { use ClosesConnections; + /** + * The server negotiator. + * + * @var \Ratchet\RFC6455\Handshake\ServerNegotiator + */ protected ServerNegotiator $negotiator; public function __construct(protected UrlMatcherInterface $matcher) @@ -64,6 +69,7 @@ public function dispatch(RequestInterface $request, Connection $connection): mix /** * Get the controller callable for the route. + * @param array $route */ protected function controller(array $route): callable { diff --git a/src/Http/Server.php b/src/Http/Server.php index c0c10651..6b82c905 100644 --- a/src/Http/Server.php +++ b/src/Http/Server.php @@ -2,7 +2,6 @@ namespace Laravel\Reverb\Http; -use GuzzleHttp\Psr7\Message; use Laravel\Reverb\Concerns\ClosesConnections; use OverflowException; use Psr\Http\Message\RequestInterface; @@ -22,7 +21,10 @@ public function __construct(protected ServerInterface $socket, protected Router $socket->on('connection', $this); } - public function __invoke(ConnectionInterface $connection) + /** + * Invoke the server. + */ + public function __invoke(ConnectionInterface $connection): void { $connection = new Connection($connection);