toString(); $translated = new Translated(); foreach ($this->runTranslateDto->getParams() as $key => $param) { /* @var \KorElf\TranslateLaravel\DTO\Parameter $param */ $texts = $splitTextIntoPartsCommand->execute($param->getText(), $param->getTextType(), $param->getDriver()); foreach ($texts as $part => $partText) { $processTranslateDto = new ProcessTranslateDto( $groupName, $key, $part, $partText, $param->getTextType(), $param->getTargetLanguageCode(), $param->getSourceLanguageCode(), $param->getDriver(), ); $chains[] = new ProcessTranslate($processTranslateDto); } $translated->add($key, count($texts)); } $chains[] = new AfterTranslate($groupName, $translated, $this->afterTranslateDto); Bus::chain($chains)->dispatch(); } }