Add DTOs, exceptions, and jobs for translation service.
Introduced new Data Transfer Objects (DTOs), exceptions, and jobs to enhance the translation service functionality. Updated namespaces for consistency and added rate limiting to the translation provider. Expanded the README with detailed usage instructions.
This commit is contained in:
59
src/DTO/ProcessTranslateDto.php
Normal file
59
src/DTO/ProcessTranslateDto.php
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace KorElf\TranslateLaravel\DTO;
|
||||
|
||||
use KorElf\TranslateLaravel\Enums\TextType;
|
||||
|
||||
final readonly class ProcessTranslateDto
|
||||
{
|
||||
public function __construct(
|
||||
private string $groupName,
|
||||
private string $key,
|
||||
private int $part,
|
||||
private string $text,
|
||||
private TextType $textType,
|
||||
private string $targetLanguageCode,
|
||||
private ?string $sourceLanguageCode = null,
|
||||
private ?string $driver = null
|
||||
) { }
|
||||
|
||||
public function getGroupName(): string
|
||||
{
|
||||
return $this->groupName;
|
||||
}
|
||||
|
||||
public function getKey(): string
|
||||
{
|
||||
return $this->key;
|
||||
}
|
||||
|
||||
public function getPart(): int
|
||||
{
|
||||
return $this->part;
|
||||
}
|
||||
|
||||
public function getText(): string
|
||||
{
|
||||
return $this->text;
|
||||
}
|
||||
|
||||
public function getTextType(): TextType
|
||||
{
|
||||
return $this->textType;
|
||||
}
|
||||
|
||||
public function getTargetLanguageCode(): string
|
||||
{
|
||||
return $this->targetLanguageCode;
|
||||
}
|
||||
|
||||
public function getSourceLanguageCode(): ?string
|
||||
{
|
||||
return $this->sourceLanguageCode;
|
||||
}
|
||||
|
||||
public function getDriver(): ?string
|
||||
{
|
||||
return $this->driver;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user