Skip to content

Commit

Permalink
removed some not required code and updated some cs issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
ssumpfAtBabymarkt committed Nov 24, 2021
1 parent bbf9385 commit d15b847
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 19 deletions.
22 changes: 3 additions & 19 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,6 @@ final class Client implements ClientInterface
{
const API_URL_SCHEMA = 'https';

/**
* API BASE URL
* https://api.deepl.com/v2/[resource]?auth_key=[yourAuthKey]
*/
const API_URL_BASE = '%s://%s/v%s/%s?auth_key=%s';

/**
* API BASE URL without authentication query parameter
* https://api.deepl.com/v2/[resource]
Expand Down Expand Up @@ -190,17 +184,6 @@ public function setTimeout($timeout)
*/
public function buildBaseUrl(string $resource = 'translate'): string
{
// if (!empty($this->authKey)) {
// return sprintf(
// self::API_URL_BASE,
// self::API_URL_SCHEMA,
// $this->host,
// $this->apiVersion,
// $resource,
// $this->authKey
// );
// }

return sprintf(
self::API_URL_BASE_NO_AUTH,
self::API_URL_SCHEMA,
Expand All @@ -222,7 +205,7 @@ public function buildQuery($paramsArray)
unset($paramsArray['text']);
$textString = '';
foreach ($text as $textElement) {
$textString .= '&text='.rawurlencode($textElement);
$textString .= '&text=' . rawurlencode($textElement);
}
}

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

if (isset($textString)) {
$body = $textString.'&'.$body;
$body = $textString . '&' . $body;
}

return $body;
Expand All @@ -246,6 +229,7 @@ public function buildQuery($paramsArray)
*
* @param $response
* @param $httpCode
*
* @return array|mixed|null
* @throws DeepLException
*/
Expand Down
3 changes: 3 additions & 0 deletions src/DeepL.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public function __construct($authKey, $apiVersion = 2, $host = 'api.deepl.com',
* @param string $type
*
* @return array
*
* @throws DeepLException
*/
public function languages($type = null)
Expand Down Expand Up @@ -65,6 +66,7 @@ public function languages($type = null)
* @param array|null $splittingTags
*
* @return array
*
* @throws DeepLException
*
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
Expand Down Expand Up @@ -113,6 +115,7 @@ public function translate(
* Calls the usage-Endpoint and return Json-response as an array
*
* @return array
*
* @throws DeepLException
*/
public function usage()
Expand Down
9 changes: 9 additions & 0 deletions src/Glossary.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public function __construct($authKey, $apiVersion = 2, $host = 'api.deepl.com',
* Calls the glossary-Endpoint and return Json-response as an array
*
* @return array
*
* @throws DeepLException
*/
public function listGlossaries()
Expand All @@ -50,7 +51,9 @@ public function listGlossaries()
* @param string $sourceLang
* @param string $targetLang
* @param string $entriesFormat
*
* @return array|null
*
* @throws DeepLException
*/
public function createGlossary(
Expand Down Expand Up @@ -83,7 +86,9 @@ public function createGlossary(
* Deletes a glossary
*
* @param string $glossaryId
*
* @return array|null
*
* @throws DeepLException
*/
public function deleteGlossary(string $glossaryId)
Expand All @@ -98,7 +103,9 @@ public function deleteGlossary(string $glossaryId)
* Gets information about a glossary
*
* @param string $glossaryId
*
* @return array|null
*
* @throws DeepLException
*/
public function glossaryInformation(string $glossaryId)
Expand All @@ -113,7 +120,9 @@ public function glossaryInformation(string $glossaryId)
* Fetch glossary entries and format them as associative array [source => target]
*
* @param string $glossaryId
*
* @return array
*
* @throws DeepLException
*/
public function glossaryEntries(string $glossaryId)
Expand Down

0 comments on commit d15b847

Please sign in to comment.