Skip to content

Commit

Permalink
fixed a string response with number at starting of text (0)
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Kluska committed Feb 25, 2016
1 parent 14c8a0d commit 22d078d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Stichoza/GoogleTranslate/TranslateClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,12 @@ private function instanceTranslate($data)
throw $e;
}

// if response in text and the content has zero the empty returns true, lets check
// if response is string and not empty and create array for further logic
if (is_string($responseArray) && $responseArray != "") {
$responseArray = [$responseArray];
}

// Check if translation exists
if (!isset($responseArray[0]) || empty($responseArray[0])) {
return false;
Expand Down

0 comments on commit 22d078d

Please sign in to comment.