@@ -20,7 +20,7 @@ class API
20
20
/**
21
21
* Constructor for API class.
22
22
*
23
- * @param string $projectId
23
+ * @param string $projectId
24
24
* @param string|null $managementKey Management key for authentication.
25
25
*/
26
26
public function __construct (string $ projectId , ?string $ managementKey )
@@ -52,7 +52,7 @@ public function __construct(string $projectId, ?string $managementKey)
52
52
* This function ensures that empty arrays in the input data are
53
53
* converted to empty objects (stdClass) before being JSON encoded.
54
54
*
55
- * @param mixed $data The data to transform, which can be an array or any other type.
55
+ * @param mixed $data The data to transform, which can be an array or any other type.
56
56
* @return mixed The transformed data with empty arrays replaced by empty objects.
57
57
*/
58
58
private function transformEmptyArraysToObjects ($ data )
@@ -76,9 +76,9 @@ private function transformEmptyArraysToObjects($data)
76
76
/**
77
77
* Requests JwtResponse from Descope APIs with the given body and auth token.
78
78
*
79
- * @param string $uri URI endpoint.
80
- * @param array $body Request body.
81
- * @param bool $useManagementKey Whether to use the management key for authentication.
79
+ * @param string $uri URI endpoint.
80
+ * @param array $body Request body.
81
+ * @param bool $useManagementKey Whether to use the management key for authentication.
82
82
* @return array JWT response array.
83
83
* @throws AuthException|GuzzleException|\JsonException If the request fails.
84
84
*/
@@ -130,8 +130,8 @@ public function doPost(string $uri, array $body, ?bool $useManagementKey = false
130
130
/**
131
131
* Sends a GET request to the specified URI with an optional auth token.
132
132
*
133
- * @param string $uri URI endpoint.
134
- * @param bool $useManagementKey Whether to use the management key for authentication.
133
+ * @param string $uri URI endpoint.
134
+ * @param bool $useManagementKey Whether to use the management key for authentication.
135
135
* @return array JWT response array.
136
136
* @throws AuthException|GuzzleException|\JsonException If the request fails.
137
137
*/
@@ -178,7 +178,7 @@ public function doGet(string $uri, bool $useManagementKey, ?string $refreshToken
178
178
/**
179
179
* Sends a DELETE request to the specified URI with an auth token.
180
180
*
181
- * @param string $uri URI endpoint.
181
+ * @param string $uri URI endpoint.
182
182
* @return array JWT response array.
183
183
* @throws AuthException|GuzzleException|\JsonException If the request fails.
184
184
*/
@@ -219,9 +219,9 @@ public function doDelete(string $uri): array
219
219
/**
220
220
* Generates a JWT response array with the given parameters.
221
221
*
222
- * @param array $responseBody
223
- * @param string|null $refreshToken Refresh token.
224
- * @param string|null $audience Audience.
222
+ * @param array $responseBody
223
+ * @param string|null $refreshToken Refresh token.
224
+ * @param string|null $audience Audience.
225
225
* @return array JWT response array.
226
226
*/
227
227
public function generateJwtResponse (array $ responseBody , ?string $ refreshToken = null , ?string $ audience = null ): array
@@ -237,7 +237,7 @@ public function generateJwtResponse(array $responseBody, ?string $refreshToken =
237
237
/**
238
238
* Generates headers for the HTTP request.
239
239
*
240
- * @param string|null $authToken Authentication token.
240
+ * @param string|null $authToken Authentication token.
241
241
* @return array Headers array.
242
242
*/
243
243
private function getHeaders (string $ authToken ): array
@@ -255,7 +255,7 @@ private function getHeaders(string $authToken): array
255
255
/**
256
256
* Constructs the auth token based on whether the management key is used.
257
257
*
258
- * @param bool $useManagementKey Whether to use the management key for authentication.
258
+ * @param bool $useManagementKey Whether to use the management key for authentication.
259
259
* @return string The constructed auth token.
260
260
*/
261
261
private function getAuthToken (bool $ useManagementKey , ?string $ refreshToken = null ): string
@@ -277,12 +277,12 @@ private function getAuthToken(bool $useManagementKey, ?string $refreshToken = nu
277
277
* This method processes the response body to extract JWTs, session data,
278
278
* and cookie settings, and adjusts properties based on the token type.
279
279
*
280
- * @param array $responseBody The API response body containing JWTs and user data.
281
- * @param string|null $refreshToken Optional refresh token.
282
- * @param bool $userJwt Indicates if user-related JWT information should be processed.
283
- * @param string|null $audience Optional audience identifier.
280
+ * @param array $responseBody The API response body containing JWTs and user data.
281
+ * @param string|null $refreshToken Optional refresh token.
282
+ * @param bool $userJwt Indicates if user-related JWT information should be processed.
283
+ * @param string|null $audience Optional audience identifier.
284
284
* @return array The structured JWT response array containing session and user data.
285
- */
285
+ */
286
286
private function generateAuthInfo (array $ responseBody , ?string $ refreshToken , bool $ userJwt , ?string $ audience ): array
287
287
{
288
288
$ jwtResponse = [];
@@ -320,10 +320,10 @@ private function generateAuthInfo(array $responseBody, ?string $refreshToken, bo
320
320
* This method sets permissions, roles, and tenant data from the JWT
321
321
* and processes the issuer and subject values to extract project and user IDs.
322
322
*
323
- * @param array $jwtResponse The JWT response array to adjust.
324
- * @param bool $userJwt Indicates if user-related JWT information should be processed.
323
+ * @param array $jwtResponse The JWT response array to adjust.
324
+ * @param bool $userJwt Indicates if user-related JWT information should be processed.
325
325
* @return array The adjusted JWT response array with updated properties.
326
- */
326
+ */
327
327
private function adjustProperties (array $ jwtResponse , bool $ userJwt ): array
328
328
{
329
329
if (isset ($ jwtResponse [EndpointsV1::$ SESSION_TOKEN_NAME ])) {
0 commit comments