@@ -64,15 +64,15 @@ discard block |
||
64 | 64 | 'client' => 'gtx', |
65 | 65 | 'hl' => 'en', |
66 | 66 | 'dt' => [ |
67 | - 't', // Translate |
|
68 | - 'bd', // Full translate with synonym ($bodyArray[1]) |
|
69 | - 'at', // Other translate ($bodyArray[5] - in google translate page this shows when click on translated word) |
|
70 | - 'ex', // Example part ($bodyArray[13]) |
|
71 | - 'ld', // I don't know ($bodyArray[8]) |
|
72 | - 'md', // Definition part with example ($bodyArray[12]) |
|
67 | + 't', // Translate |
|
68 | + 'bd', // Full translate with synonym ($bodyArray[1]) |
|
69 | + 'at', // Other translate ($bodyArray[5] - in google translate page this shows when click on translated word) |
|
70 | + 'ex', // Example part ($bodyArray[13]) |
|
71 | + 'ld', // I don't know ($bodyArray[8]) |
|
72 | + 'md', // Definition part with example ($bodyArray[12]) |
|
73 | 73 | 'qca', // I don't know ($bodyArray[8]) |
74 | - 'rw', // Read also part ($bodyArray[14]) |
|
75 | - 'rm', // I don't know |
|
74 | + 'rw', // Read also part ($bodyArray[14]) |
|
75 | + 'rm', // I don't know |
|
76 | 76 | 'ss' // Full synonym ($bodyArray[11]) |
77 | 77 | ], |
78 | 78 | 'sl' => null, // Source language |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | * @param TokenProviderInterface|null $tokenProvider |
117 | 117 | * @param bool|string $preserveParameters Boolean or custom regex pattern to match parameters |
118 | 118 | */ |
119 | - public function __construct(string $target = 'en', string $source = null, array $options = [], TokenProviderInterface $tokenProvider = null, bool|string $preserveParameters = false) |
|
119 | + public function __construct(string $target = 'en', string $source = null, array $options = [], TokenProviderInterface $tokenProvider = null, bool | string $preserveParameters = false) |
|
120 | 120 | { |
121 | 121 | $this->client = new Client(); |
122 | 122 | $this->setTokenProvider($tokenProvider ?? new GoogleTokenGenerator) |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | * @throws TranslationRequestException If any other HTTP related error occurs |
224 | 224 | * @throws TranslationDecodingException If response JSON cannot be decoded |
225 | 225 | */ |
226 | - public static function trans(string $string, string $target = 'en', string $source = null, array $options = [], TokenProviderInterface $tokenProvider = null, bool|string $preserveParameters = false): ?string |
|
226 | + public static function trans(string $string, string $target = 'en', string $source = null, array $options = [], TokenProviderInterface $tokenProvider = null, bool | string $preserveParameters = false): ?string |
|
227 | 227 | { |
228 | 228 | return (new self) |
229 | 229 | ->setTokenProvider($tokenProvider ?? new GoogleTokenGenerator) |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | if (is_string($responseArray)) { |
296 | 296 | $output = $responseArray; |
297 | 297 | } elseif (is_array($responseArray[0])) { |
298 | - $output = (string) array_reduce($responseArray[0], static function ($carry, $item) { |
|
298 | + $output = (string) array_reduce($responseArray[0], static function($carry, $item) { |
|
299 | 299 | $carry .= $item[0]; |
300 | 300 | return $carry; |
301 | 301 | }); |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | * @param bool|string $pattern Boolean or custom regex pattern to match parameters |
316 | 316 | * @return self |
317 | 317 | */ |
318 | - public function preserveParameters(bool|string $pattern = true): self |
|
318 | + public function preserveParameters(bool | string $pattern = true): self |
|
319 | 319 | { |
320 | 320 | if ($pattern === true) { |
321 | 321 | $this->pattern = '/:(\w+)/'; // Default regex |
@@ -344,12 +344,12 @@ discard block |
||
344 | 344 | // Replace all matches of our pattern with #{\d} for replacement later |
345 | 345 | return preg_replace_callback( |
346 | 346 | $this->pattern, |
347 | - function ($matches) { |
|
347 | + function($matches) { |
|
348 | 348 | static $index = -1; |
349 | 349 | |
350 | 350 | $index++; |
351 | 351 | |
352 | - return '#{' . $index . '}'; |
|
352 | + return '#{'.$index.'}'; |
|
353 | 353 | }, |
354 | 354 | $string |
355 | 355 | ); |