Skip to content

Commit 1a9e980

Browse files
committed
Clean-up docs
1 parent 39b128f commit 1a9e980

File tree

4 files changed

+35
-33
lines changed

4 files changed

+35
-33
lines changed

src/VerifierServer/Endpoints/VerifiedEndpoint.php

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ public function __construct(private PersistentState &$state)
1414
/**
1515
* Handles the incoming HTTP request and generates the appropriate response.
1616
*
17-
* @param string $method The HTTP method of the request (e.g., 'GET', 'POST').
18-
* @param ServerRequestInterface|string $request The request payload, typically used for 'POST' requests.
19-
* @param string &$response The variable to store the generated response.
20-
* @param array &$content_type The variable to store the content type of the response.
21-
* @param string &$body The variable to store the body of the response.
17+
* @param string $method The HTTP method of the request (e.g., 'GET', 'POST').
18+
* @param ServerRequestInterface|string $request The request payload, typically used for 'POST' requests.
19+
* @param string &$response The variable to store the generated response.
20+
* @param array &$content_type The variable to store the content type of the response.
21+
* @param string &$body The variable to store the body of the response.
2222
*/
2323
public function handle(string $method, ServerRequestInterface|string $request, int|string &$response, array &$content_type, string &$body, bool $bypass_token = false): void
2424
{
@@ -41,9 +41,9 @@ public function handle(string $method, ServerRequestInterface|string $request, i
4141
/**
4242
* Handles the GET request and prepares the response.
4343
*
44-
* @param string &$response The response string to be sent back to the client.
45-
* @param array &$content_type The variable to store the content type of the response.
46-
* @param string &$body The variable to store the body of the response.
44+
* @param string &$response The response string to be sent back to the client.
45+
* @param array &$content_type The variable to store the content type of the response.
46+
* @param string &$body The variable to store the body of the response.
4747
*
4848
* This method sets the HTTP status code to 200 OK and the Content-Type to application/json.
4949
* It then appends the JSON-encoded verification list to the response.
@@ -58,10 +58,10 @@ private function get(int|string &$response, array &$content_type, string &$body)
5858
/**
5959
* Handles POST requests by parsing the request data and performing actions based on the method type.
6060
*
61-
* @param ServerRequestInterface|string $request The raw HTTP request string.
62-
* @param string &$response The response string to be modified based on the request handling.
63-
* @param array &$content_type The variable to store the content type of the response.
64-
* @param string &$body The variable to store the body of the response.
61+
* @param ServerRequestInterface|string $request The raw HTTP request string.
62+
* @param string &$response The response string to be modified based on the request handling.
63+
* @param array &$content_type The variable to store the content type of the response.
64+
* @param string &$body The variable to store the body of the response.
6565
*
6666
* The function performs the following steps:
6767
* 1. Extracts the raw data from the request.
@@ -141,12 +141,12 @@ private function post(ServerRequestInterface|string $request, int|string &$respo
141141
* If neither exists, it adds the new entry to the list, writes the updated list to a JSON file,
142142
* updates the state, and sets the response to a 200 OK status.
143143
*
144-
* @param array $list The list of existing entries.
145-
* @param string $ckey The ckey to be verified.
146-
* @param string $discord The discord identifier to be verified.
147-
* @param string &$response The response message to be set based on the verification result.
148-
* @param array &$content_type The variable to store the content type of the response.
149-
* @param string &$body The variable to store the body of the response.
144+
* @param array $list The list of existing entries.
145+
* @param string $ckey The ckey to be verified.
146+
* @param string $discord The discord identifier to be verified.
147+
* @param string &$response The response message to be set based on the verification result.
148+
* @param array &$content_type The variable to store the content type of the response.
149+
* @param string &$body The variable to store the body of the response.
150150
*/
151151
private function __post(array &$list, string $ckey, string $discord, int|string &$response, array &$content_type, string &$body): void
152152
{
@@ -175,10 +175,10 @@ private function __post(array &$list, string $ckey, string $discord, int|string
175175
* Handles the deletion of an item from the list.
176176
*
177177
* @param int|string|false $existingIndex The index of the item to delete, or false if the item does not exist.
178-
* @param array &$list The list from which the item will be deleted.
179-
* @param string &$response The HTTP response message to be returned.
180-
* @param array &$content_type The variable to store the content type of the response.
181-
* @param string &$body The variable to store the body of the response.
178+
* @param array &$list The list from which the item will be deleted.
179+
* @param string &$response The HTTP response message to be returned.
180+
* @param array &$content_type The variable to store the content type of the response.
181+
* @param string &$body The variable to store the body of the response.
182182
*/
183183
private function delete(int|string|false $existingIndex, array &$list, int|string &$response, array &$content_type, string &$body): void
184184
{

src/VerifierServer/PersistentState.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,12 @@ public function getVerifyList(bool $getLocalCache = false): array
105105
* it simply assigns the provided list to the verifyList property. If the storage type is not 'filesystem',
106106
* it updates the verify_list table in the database.
107107
*
108-
* @param array $list The list of verification items to be set. Each item in the list should be an associative array
109-
* with keys 'ss13', 'discord', and 'create_time'.
110-
* @param bool $write Whether to write the list to the database. Default is true.
108+
* @param array $list The list of verification items to be set. Each item in the list should be an associative array
109+
* with keys 'ss13', 'discord', and 'create_time'.
110+
* @param bool $write Whether to write the list to the database. Default is true.
111111
*
112112
* @throws \PDOException If there is an error deleting from the verify_list table, preparing the insert statement,
113-
* or executing the insert statement.
113+
* or executing the insert statement.
114114
*/
115115
public function setVerifyList(array $list, bool $write = true): void
116116
{
@@ -240,7 +240,7 @@ public static function loadVerifyFile(string $json_path): ?array
240240
* Writes the given data to a file in JSON format.
241241
*
242242
* @param string $file The path to the file where the JSON data will be written.
243-
* @param mixed $data The data to be encoded as JSON and written to the file.
243+
* @param mixed $data The data to be encoded as JSON and written to the file.
244244
*/
245245
public static function writeJson(string $file, array $data): void
246246
{

src/VerifierServer/Server.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ public function __construct(
3535
/**
3636
* Logs an error message with details about the exception.
3737
*
38-
* @param \Exception $e The exception to log.
39-
* @param bool $fatal Optional. Indicates whether the error is fatal. Defaults to false.
40-
* If true, the server will stop after logging the error.
38+
* @param \Exception $e The exception to log.
39+
* @param bool $fatal Optional. Indicates whether the error is fatal. Defaults to false.
40+
* If true, the server will stop after logging the error.
4141
*
4242
* @return string
4343
*/
@@ -166,7 +166,7 @@ public function setLogger(Logger|bool $logger = false): void
166166
/**
167167
* Handles the incoming client request.
168168
*
169-
* @param ServerRequestInterface|resource $request The client resource to handle.
169+
* @param ServerRequestInterface|resource $request The client resource to handle.
170170
*
171171
* @throws \Exception If the client resource is invalid, reading from the client fails, or writing to the client fails.
172172
*
@@ -302,8 +302,9 @@ public function handleResource($client): null
302302
* Each key-value pair in the array is transformed into a string
303303
* in the format "key: value" and concatenated with a newline character.
304304
*
305-
* @param array $formData The associative array to be converted.
306-
* @return string The resulting request string.
305+
* @param array $formData The associative array to be converted.
306+
*
307+
* @return string The resulting request string.
307308
*/
308309
public static function arrayToRequestString(array $formData): string
309310
{

tests/VerifiedEndpointTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ public function testPost() {
5454
* Converts an associative array back into the original string format.
5555
*
5656
* @param array $formData The associative array to be converted.
57+
*
5758
* @return string The reconstructed string.
5859
*/
5960
$response = 0;

0 commit comments

Comments
 (0)