@@ -213,7 +213,6 @@ |
||
| 213 | 213 | /** |
| 214 | 214 | * Set the api we are used to translete. |
| 215 | 215 | * |
| 216 | - * @param string $source Google translate api, default is https://translate.google.com/translate_a/single |
|
| 217 | 216 | * |
| 218 | 217 | * @return TranslateClient |
| 219 | 218 | */ |
@@ -356,10 +356,10 @@ |
||
| 356 | 356 | // Whether or not is the data an array |
| 357 | 357 | $isArray = is_array($data); |
| 358 | 358 | |
| 359 | - if($isArray){ |
|
| 360 | - // implode array into string, with elements delimited by new paragraph (\r\n) |
|
| 361 | - $data = implode("\r\n", $data); |
|
| 362 | - } |
|
| 359 | + if($isArray){ |
|
| 360 | + // implode array into string, with elements delimited by new paragraph (\r\n) |
|
| 361 | + $data = implode("\r\n", $data); |
|
| 362 | + } |
|
| 363 | 363 | // Rethrow exceptions |
| 364 | 364 | try { |
| 365 | 365 | $responseArray = $this->getResponse($data); |
@@ -356,7 +356,7 @@ discard block |
||
| 356 | 356 | // Whether or not is the data an array |
| 357 | 357 | $isArray = is_array($data); |
| 358 | 358 | |
| 359 | - if($isArray){ |
|
| 359 | + if ($isArray) { |
|
| 360 | 360 | // implode array into string, with elements delimited by new paragraph (\r\n) |
| 361 | 361 | $data = implode("\r\n", $data); |
| 362 | 362 | } |
@@ -416,7 +416,7 @@ discard block |
||
| 416 | 416 | // Reduce array to generate translated sentenece |
| 417 | 417 | if ($isArray) { |
| 418 | 418 | if (is_array($responseArray[0])) { |
| 419 | - return array_reduce($responseArray[0], function ($carry, $item) { |
|
| 419 | + return array_reduce($responseArray[0], function($carry, $item) { |
|
| 420 | 420 | $carry[] = trim($item[0], "\r\n"); |
| 421 | 421 | |
| 422 | 422 | return $carry; |
@@ -430,7 +430,7 @@ discard block |
||
| 430 | 430 | return $responseArray; |
| 431 | 431 | } else { |
| 432 | 432 | if (is_array($responseArray[0])) { |
| 433 | - return array_reduce($responseArray[0], function ($carry, $item) { |
|
| 433 | + return array_reduce($responseArray[0], function($carry, $item) { |
|
| 434 | 434 | $carry .= $item[0]; |
| 435 | 435 | |
| 436 | 436 | return $carry; |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | * @param string $target Target language |
| 18 | 18 | * @param string $text Text to translate |
| 19 | 19 | * |
| 20 | - * @return mixed A token |
|
| 20 | + * @return string A token |
|
| 21 | 21 | */ |
| 22 | 22 | public function generateToken($source, $target, $text) |
| 23 | 23 | { |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | * http://stackoverflow.com/a/43359819/2953830 |
| 107 | 107 | * |
| 108 | 108 | * @param $a |
| 109 | - * @param $b |
|
| 109 | + * @param integer $b |
|
| 110 | 110 | * |
| 111 | 111 | * @return number |
| 112 | 112 | */ |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | * @param string $str |
| 144 | 144 | * @param int $index |
| 145 | 145 | * |
| 146 | - * @return null|number |
|
| 146 | + * @return string |
|
| 147 | 147 | */ |
| 148 | 148 | private function charCodeAt($str, $index) |
| 149 | 149 | { |
@@ -113,7 +113,7 @@ |
||
| 113 | 113 | private function unsignedRightShift($a, $b) |
| 114 | 114 | { |
| 115 | 115 | if ($b >= 32 || $b < -32) { |
| 116 | - $m = (int)($b / 32); |
|
| 116 | + $m = (int) ($b / 32); |
|
| 117 | 117 | $b = $b - ($m * 32); |
| 118 | 118 | } |
| 119 | 119 | |