| @@ -224,7 +224,9 @@ | ||
| 224 | 224 | * if source lang and target lang are the same | 
| 225 | 225 | * just return the string without any request to google | 
| 226 | 226 | */ | 
| 227 | - if ($this->source == $this->target) return $string; | |
| 227 | +        if ($this->source == $this->target) { | |
| 228 | + return $string; | |
| 229 | + } | |
| 228 | 230 | |
| 229 | 231 | $responseArray = $this->getResponse($string); | 
| 230 | 232 | |
| @@ -56,15 +56,15 @@ discard block | ||
| 56 | 56 | 'client' => 'gtx', | 
| 57 | 57 | 'hl' => 'en', | 
| 58 | 58 | 'dt' => [ | 
| 59 | - 't', // Translate | |
| 60 | - 'bd', // Full translate with synonym ($bodyArray[1]) | |
| 61 | - 'at', // Other translate ($bodyArray[5] - in google translate page this shows when click on translated word) | |
| 62 | - 'ex', // Example part ($bodyArray[13]) | |
| 63 | - 'ld', // I don't know ($bodyArray[8]) | |
| 64 | - 'md', // Definition part with example ($bodyArray[12]) | |
| 59 | + 't', // Translate | |
| 60 | + 'bd', // Full translate with synonym ($bodyArray[1]) | |
| 61 | + 'at', // Other translate ($bodyArray[5] - in google translate page this shows when click on translated word) | |
| 62 | + 'ex', // Example part ($bodyArray[13]) | |
| 63 | + 'ld', // I don't know ($bodyArray[8]) | |
| 64 | + 'md', // Definition part with example ($bodyArray[12]) | |
| 65 | 65 | 'qca', // I don't know ($bodyArray[8]) | 
| 66 | - 'rw', // Read also part ($bodyArray[14]) | |
| 67 | - 'rm', // I don't know | |
| 66 | + 'rw', // Read also part ($bodyArray[14]) | |
| 67 | + 'rm', // I don't know | |
| 68 | 68 | 'ss' // Full synonym ($bodyArray[11]) | 
| 69 | 69 | ], | 
| 70 | 70 | 'sl' => null, // Source language | 
| @@ -275,7 +275,7 @@ discard block | ||
| 275 | 275 | return $responseArray; | 
| 276 | 276 |          } else { | 
| 277 | 277 |              if (is_array($responseArray[0])) { | 
| 278 | -                return (string) array_reduce($responseArray[0], function ($carry, $item) { | |
| 278 | +                return (string) array_reduce($responseArray[0], function($carry, $item) { | |
| 279 | 279 | $carry .= $item[0]; | 
| 280 | 280 | return $carry; | 
| 281 | 281 | }); | 
| @@ -112,7 +112,7 @@ discard block | ||
| 112 | 112 | private function unsignedRightShift($a, $b) | 
| 113 | 113 |      { | 
| 114 | 114 |          if ($b >= 32 || $b < -32) { | 
| 115 | - $m = (int)($b / 32); | |
| 115 | + $m = (int) ($b / 32); | |
| 116 | 116 | $b = $b - ($m * 32); | 
| 117 | 117 | } | 
| 118 | 118 | |
| @@ -147,7 +147,7 @@ discard block | ||
| 147 | 147 | private function JS_charCodeAt($str, $index) | 
| 148 | 148 |      { | 
| 149 | 149 | $utf16 = mb_convert_encoding($str, 'UTF-16LE', 'UTF-8'); | 
| 150 | - return ord($utf16[$index*2]) + (ord($utf16[$index*2+1]) << 8); | |
| 150 | + return ord($utf16[$index * 2]) + (ord($utf16[$index * 2 + 1]) << 8); | |
| 151 | 151 | } | 
| 152 | 152 | |
| 153 | 153 | /** | 
| @@ -160,6 +160,6 @@ discard block | ||
| 160 | 160 | private function JS_length($str) | 
| 161 | 161 |      { | 
| 162 | 162 | $utf16 = mb_convert_encoding($str, 'UTF-16LE', 'UTF-8'); | 
| 163 | - return strlen($utf16)/2; | |
| 163 | + return strlen($utf16) / 2; | |
| 164 | 164 | } | 
| 165 | 165 | } |