Skip to content

Commit f196d52

Browse files
committed
Remove generic handle function
1 parent 819f71a commit f196d52

File tree

1 file changed

+1
-29
lines changed

1 file changed

+1
-29
lines changed

src/VerifierServer/Server.php

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public function init(?LoopInterface $loop = null, bool $stream_socket_server = f
7878
$this->loop = $loop instanceof LoopInterface
7979
? $loop
8080
: Loop::get(),
81-
fn($request) => $this->handle($request)
81+
fn($request) => $this->handleReact($request)
8282
);
8383
$this->server->on('error', fn(\Throwable $e) => $this->logError($e, true));
8484
$this->socket = new SocketServer($this->hostAddr, [], $this->loop);
@@ -173,34 +173,6 @@ public function setLogger(Logger|bool $logger = false): void
173173
$this->logger = $logger;
174174
}
175175

176-
/**
177-
* Handles the incoming client request.
178-
*
179-
* @param ServerRequestInterface|resource $request The client resource to handle.
180-
*
181-
* @throws \Exception If the client resource is invalid, reading from the client fails, or writing to the client fails.
182-
*
183-
* @return ResponseInterface|null The response to send back to the client, or null if the client is a resource.
184-
*
185-
* This method reads the request from the client, parses the HTTP method and URI, and generates an appropriate response.
186-
* It supports the following URIs:
187-
* - `/`: Redirects to `/verified`.
188-
* - `/verified`: Processes the request using the VerifiedEndpoint class.
189-
* - Any other URI: Returns a 404 Not Found response.
190-
*
191-
* If the logger mode is enabled, the request and response are printed to the console.
192-
*/
193-
public function handle($client): ?ResponseInterface
194-
{
195-
if (! $client instanceof ServerRequestInterface && ! is_resource($client)) {
196-
throw new \Exception("Invalid client resource");
197-
}
198-
199-
return $client instanceof ServerRequestInterface
200-
? $this->handleReact($client)
201-
: $this->handleResource($client);
202-
}
203-
204176
/**
205177
* Handles an incoming resource request from a client and generates appropriate responses.
206178
*

0 commit comments

Comments
 (0)