Skip to content

Commit

Permalink
wrong order code not executed cause returns first
Browse files Browse the repository at this point in the history
  • Loading branch information
innomedia committed May 4, 2022
1 parent c317f26 commit bbf4a66
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/DeepL.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,16 +99,6 @@ private static function TranslationRequest($apikey, $targetlang, array $texts, $
}
if ($httpCode !== 200) {
return $text;
}
$data = json_decode($response, true);
try
{
if (json_decode($response)->translations && count(json_decode($response)->translations) > 0) {
return $data;
}
return null;
} catch (Exception $ex) {

}
try
{
Expand All @@ -125,6 +115,16 @@ private static function TranslationRequest($apikey, $targetlang, array $texts, $
}catch(Exception $ex)
{

}
$data = json_decode($response, true);
try
{
if (json_decode($response)->translations && count(json_decode($response)->translations) > 0) {
return $data;
}
return null;
} catch (Exception $ex) {

}
}

Expand Down

0 comments on commit bbf4a66

Please sign in to comment.