Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit d15b847

Browse files
removed some not required code and updated some cs issues.
1 parent bbf9385 commit d15b847

File tree

3 files changed

+15
-19
lines changed

3 files changed

+15
-19
lines changed

src/Client.php

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,6 @@ final class Client implements ClientInterface
99
{
1010
const API_URL_SCHEMA = 'https';
1111

12-
/**
13-
* API BASE URL
14-
* https://api.deepl.com/v2/[resource]?auth_key=[yourAuthKey]
15-
*/
16-
const API_URL_BASE = '%s://%s/v%s/%s?auth_key=%s';
17-
1812
/**
1913
* API BASE URL without authentication query parameter
2014
* https://api.deepl.com/v2/[resource]
@@ -190,17 +184,6 @@ public function setTimeout($timeout)
190184
*/
191185
public function buildBaseUrl(string $resource = 'translate'): string
192186
{
193-
// if (!empty($this->authKey)) {
194-
// return sprintf(
195-
// self::API_URL_BASE,
196-
// self::API_URL_SCHEMA,
197-
// $this->host,
198-
// $this->apiVersion,
199-
// $resource,
200-
// $this->authKey
201-
// );
202-
// }
203-
204187
return sprintf(
205188
self::API_URL_BASE_NO_AUTH,
206189
self::API_URL_SCHEMA,
@@ -222,7 +205,7 @@ public function buildQuery($paramsArray)
222205
unset($paramsArray['text']);
223206
$textString = '';
224207
foreach ($text as $textElement) {
225-
$textString .= '&text='.rawurlencode($textElement);
208+
$textString .= '&text=' . rawurlencode($textElement);
226209
}
227210
}
228211

@@ -235,7 +218,7 @@ public function buildQuery($paramsArray)
235218
$body = http_build_query($paramsArray, null, '&');
236219

237220
if (isset($textString)) {
238-
$body = $textString.'&'.$body;
221+
$body = $textString . '&' . $body;
239222
}
240223

241224
return $body;
@@ -246,6 +229,7 @@ public function buildQuery($paramsArray)
246229
*
247230
* @param $response
248231
* @param $httpCode
232+
*
249233
* @return array|mixed|null
250234
* @throws DeepLException
251235
*/

src/DeepL.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ public function __construct($authKey, $apiVersion = 2, $host = 'api.deepl.com',
3737
* @param string $type
3838
*
3939
* @return array
40+
*
4041
* @throws DeepLException
4142
*/
4243
public function languages($type = null)
@@ -65,6 +66,7 @@ public function languages($type = null)
6566
* @param array|null $splittingTags
6667
*
6768
* @return array
69+
*
6870
* @throws DeepLException
6971
*
7072
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
@@ -113,6 +115,7 @@ public function translate(
113115
* Calls the usage-Endpoint and return Json-response as an array
114116
*
115117
* @return array
118+
*
116119
* @throws DeepLException
117120
*/
118121
public function usage()

src/Glossary.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public function __construct($authKey, $apiVersion = 2, $host = 'api.deepl.com',
3535
* Calls the glossary-Endpoint and return Json-response as an array
3636
*
3737
* @return array
38+
*
3839
* @throws DeepLException
3940
*/
4041
public function listGlossaries()
@@ -50,7 +51,9 @@ public function listGlossaries()
5051
* @param string $sourceLang
5152
* @param string $targetLang
5253
* @param string $entriesFormat
54+
*
5355
* @return array|null
56+
*
5457
* @throws DeepLException
5558
*/
5659
public function createGlossary(
@@ -83,7 +86,9 @@ public function createGlossary(
8386
* Deletes a glossary
8487
*
8588
* @param string $glossaryId
89+
*
8690
* @return array|null
91+
*
8792
* @throws DeepLException
8893
*/
8994
public function deleteGlossary(string $glossaryId)
@@ -98,7 +103,9 @@ public function deleteGlossary(string $glossaryId)
98103
* Gets information about a glossary
99104
*
100105
* @param string $glossaryId
106+
*
101107
* @return array|null
108+
*
102109
* @throws DeepLException
103110
*/
104111
public function glossaryInformation(string $glossaryId)
@@ -113,7 +120,9 @@ public function glossaryInformation(string $glossaryId)
113120
* Fetch glossary entries and format them as associative array [source => target]
114121
*
115122
* @param string $glossaryId
123+
*
116124
* @return array
125+
*
117126
* @throws DeepLException
118127
*/
119128
public function glossaryEntries(string $glossaryId)

0 commit comments

Comments
 (0)