@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | curl_setopt($this->curl, CURLOPT_URL, $url); |
121 | 121 | |
122 | 122 | curl_setopt($this->curl, CURLOPT_HTTPHEADER, ['Content-Type: application/x-www-form-urlencoded']); |
123 | - curl_setopt($this->curl, CURLOPT_HTTPHEADER, ['Authorization: DeepL-Auth-Key ' . $this->authKey]); |
|
123 | + curl_setopt($this->curl, CURLOPT_HTTPHEADER, ['Authorization: DeepL-Auth-Key '.$this->authKey]); |
|
124 | 124 | |
125 | 125 | if ($this->proxy !== null) { |
126 | 126 | curl_setopt($this->curl, CURLOPT_PROXY, $this->proxy); |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | $response = curl_exec($this->curl); |
138 | 138 | |
139 | 139 | if (curl_errno($this->curl)) { |
140 | - throw new DeepLException('There was a cURL Request Error : ' . curl_error($this->curl)); |
|
140 | + throw new DeepLException('There was a cURL Request Error : '.curl_error($this->curl)); |
|
141 | 141 | } |
142 | 142 | $httpCode = curl_getinfo($this->curl, CURLINFO_HTTP_CODE); |
143 | 143 | |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | unset($paramsArray['text']); |
206 | 206 | $textString = ''; |
207 | 207 | foreach ($text as $textElement) { |
208 | - $textString .= '&text=' . rawurlencode($textElement); |
|
208 | + $textString .= '&text='.rawurlencode($textElement); |
|
209 | 209 | } |
210 | 210 | } |
211 | 211 | |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | $body = http_build_query($paramsArray, null, '&'); |
219 | 219 | |
220 | 220 | if (isset($textString)) { |
221 | - $body = $textString . '&' . $body; |
|
221 | + $body = $textString.'&'.$body; |
|
222 | 222 | } |
223 | 223 | |
224 | 224 | return $body; |
@@ -245,46 +245,46 @@ |
||
245 | 245 | throw new DeepLException($responseArray['message'], $httpCode); |
246 | 246 | } |
247 | 247 | |
248 | - /** |
|
249 | - * @see https://www.deepl.com/docs-api/accessing-the-api/error-handling/ |
|
250 | - */ |
|
251 | - switch ($httpCode) { |
|
252 | - case '400': |
|
253 | - throw new DeepLException('Bad request. Please check error message and your parameters.', $httpCode); |
|
254 | - break; |
|
255 | - |
|
256 | - case '403': |
|
257 | - throw new DeepLException('Authorization failed. Please supply a valid auth_key parameter.', $httpCode); |
|
258 | - break; |
|
259 | - |
|
260 | - case '404': |
|
261 | - throw new DeepLException('The requested resource could not be found.', $httpCode); |
|
262 | - break; |
|
263 | - |
|
264 | - case '413': |
|
265 | - throw new DeepLException('The request size exceeds the limit.', $httpCode); |
|
266 | - break; |
|
267 | - |
|
268 | - case '414': |
|
269 | - throw new DeepLException('The request URL is too long. You can avoid this error by using a POST request instead of a GET request, and sending the parameters in the HTTP body.', $httpCode); |
|
270 | - break; |
|
271 | - |
|
272 | - case '429': |
|
273 | - throw new DeepLException('Too many requests. Please wait and resend your request.', $httpCode); |
|
274 | - break; |
|
275 | - |
|
276 | - case '456': |
|
277 | - throw new DeepLException('Quota exceeded. The character limit has been reached.', $httpCode); |
|
278 | - break; |
|
279 | - |
|
280 | - case '503': |
|
281 | - throw new DeepLException('Resource currently unavailable. Try again later.', $httpCode); |
|
282 | - break; |
|
283 | - |
|
284 | - case '529': |
|
285 | - throw new DeepLException('Too many requests. Please wait and resend your request.', $httpCode); |
|
286 | - break; |
|
287 | - } |
|
248 | + /** |
|
249 | + * @see https://www.deepl.com/docs-api/accessing-the-api/error-handling/ |
|
250 | + */ |
|
251 | + switch ($httpCode) { |
|
252 | + case '400': |
|
253 | + throw new DeepLException('Bad request. Please check error message and your parameters.', $httpCode); |
|
254 | + break; |
|
255 | + |
|
256 | + case '403': |
|
257 | + throw new DeepLException('Authorization failed. Please supply a valid auth_key parameter.', $httpCode); |
|
258 | + break; |
|
259 | + |
|
260 | + case '404': |
|
261 | + throw new DeepLException('The requested resource could not be found.', $httpCode); |
|
262 | + break; |
|
263 | + |
|
264 | + case '413': |
|
265 | + throw new DeepLException('The request size exceeds the limit.', $httpCode); |
|
266 | + break; |
|
267 | + |
|
268 | + case '414': |
|
269 | + throw new DeepLException('The request URL is too long. You can avoid this error by using a POST request instead of a GET request, and sending the parameters in the HTTP body.', $httpCode); |
|
270 | + break; |
|
271 | + |
|
272 | + case '429': |
|
273 | + throw new DeepLException('Too many requests. Please wait and resend your request.', $httpCode); |
|
274 | + break; |
|
275 | + |
|
276 | + case '456': |
|
277 | + throw new DeepLException('Quota exceeded. The character limit has been reached.', $httpCode); |
|
278 | + break; |
|
279 | + |
|
280 | + case '503': |
|
281 | + throw new DeepLException('Resource currently unavailable. Try again later.', $httpCode); |
|
282 | + break; |
|
283 | + |
|
284 | + case '529': |
|
285 | + throw new DeepLException('Too many requests. Please wait and resend your request.', $httpCode); |
|
286 | + break; |
|
287 | + } |
|
288 | 288 | |
289 | 289 | if (!is_array($responseArray)) { |
290 | 290 | throw new DeepLException('The Response seems to not be valid JSON.', $httpCode); |