@@ -28,10 +28,12 @@ class Client
2828 /**
2929 * Perform a request
3030 *
31- * @param string $method Method name
32- * @param array $payload Request payload
31+ * @param string $method HTTP method name (GET, POST, etc.)
32+ * @param string $path API endpoint path
33+ * @param array|null $payload Request payload data
3334 *
34- * @return object
35+ * @return array Response data
36+ * @throws \DetectLanguage\Error When API request fails, invalid response received, or authentication fails
3537 */
3638 public static function request ($ method , $ path , $ payload = null )
3739 {
@@ -55,11 +57,6 @@ public static function request($method, $path, $payload = null)
5557 return $ response ;
5658 }
5759
58- /**
59- * Get request method name.
60- *
61- * @return string
62- */
6360 protected static function getEngineMethodName ()
6461 {
6562 $ request_engine = self ::$ requestEngine ;
@@ -84,8 +81,9 @@ protected static function getEngineMethodName()
8481 /**
8582 * Perform request using native PHP streams
8683 *
84+ * @param string $method HTTP method name
8785 * @param string $url Request URL
88- * @param string $body Request body
86+ * @param string|null $body Request body
8987 *
9088 * @return string Response body
9189 */
@@ -112,10 +110,12 @@ protected static function requestStream($method, $url, $body)
112110 /**
113111 * Perform request using CURL extension.
114112 *
113+ * @param string $method HTTP method name
115114 * @param string $url Request URL
116- * @param string $body Request body
115+ * @param string|null $body Request body
117116 *
118117 * @return string Response body
118+ * @throws \DetectLanguage\Error When CURL request fails, times out, or connection fails
119119 */
120120 protected static function requestCurl ($ method , $ url , $ body )
121121 {
@@ -154,7 +154,7 @@ protected static function requestCurl($method, $url, $body)
154154 * Build URL for given method
155155 *
156156 * @param string $method Method name
157- * @return string
157+ * @return string Complete API URL
158158 */
159159 protected static function getUrl ($ method )
160160 {
@@ -164,7 +164,7 @@ protected static function getUrl($method)
164164 /**
165165 * Build request headers.
166166 *
167- * @return array
167+ * @return array Array of HTTP headers
168168 */
169169 protected static function getHeaders ()
170170 {
@@ -179,7 +179,7 @@ protected static function getHeaders()
179179 /**
180180 * Get User-Agent for the request.
181181 *
182- * @return string
182+ * @return string User-Agent string
183183 */
184184 protected static function getUserAgent ()
185185 {
0 commit comments