class BingTranslator implements TranslatorInterface
8
{
9
private $from;
10
11
private $to;
12
13
private $chunkSize;
14
15
8
public function __construct(string $from, string $to, int $chunkSize = 100)
16
{
17
8
$this->from = $from;
18
8
$this->to = $to;
19
8
$this->chunkSize = $chunkSize;
20
8
}
21
22
4
public function translate(array $texts): array
23
{
24
4
$newTexts = [];
25
26
// TODO change chunk size to real character count limit (https://social.microsoft.com/Forums/en-US/abf2a48f-d8c7-41db-a1fa-00066e7040f4/limits-in-request-to-bing-translator-api?forum=translator)
27
4
foreach (array_chunk($texts, $this->chunkSize) as $strings) {