Lines
80.00%
4 / 5
Methods
80.00%
4 / 5
Classes
0.00%
0 / 1
| Name | Lines | Methods | CRAP | ||||
|---|---|---|---|---|---|---|---|
| __construct | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | ||
| getContentType | 0.00% | 0 / 1 | 0.00% | 0 / 1 | 2 | ||
| getSourceLang | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | ||
| getTargetLang | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | ||
| getFields | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | ||
| 27 | readonly class TranslationRequest | |
| 28 | { | |
| 29 | /** | |
| 30 | * Constructor. | |
| 31 | * | |
| 32 | * @param string $contentType Content type ('faq', 'customPage', 'category', 'news') | |
| 33 | * @param string $sourceLang Source language code (ISO 639-1) | |
| 34 | * @param string $targetLang Target language code (ISO 639-1) | |
| 35 | * @param array<string, string> $fields Fields to translate (fieldName => value) | |
| 36 | */ | |
| 37 | public function __construct( | |
| 38 | private string $contentType, | |
| 39 | private string $sourceLang, | |
| 40 | private string $targetLang, | |
| 41 | private array $fields, | |
| 42 | ) { | |
| 43 | } | |
| 44 | ||
| 45 | /** | |
| 46 | * Get content type. | |
| 47 | * | |
| 48 | * @return string | |
| 49 | */ | |
| 50 | public function getContentType(): string | |
| 51 | { | |
| 52 | return $this->contentType; | |
| 53 | } | |
| 54 | ||
| 55 | /** | |
| 56 | * Get source language. | |
| 57 | * | |
| 58 | * @return string | |
| 59 | */ | |
| 60 | public function getSourceLang(): string | |
| 61 | { | |
| 62 | return $this->sourceLang; | |
| 63 | } | |
| 64 | ||
| 65 | /** | |
| 66 | * Get target language. | |
| 67 | * | |
| 68 | * @return string | |
| 69 | */ | |
| 70 | public function getTargetLang(): string | |
| 71 | { | |
| 72 | return $this->targetLang; | |
| 73 | } | |
| 74 | ||
| 75 | /** | |
| 76 | * Get fields to translate. | |
| 77 | * | |
| 78 | * @return array<string, string> | |
| 79 | */ | |
| 80 | public function getFields(): array | |
| 81 | { | |
| 82 | return $this->fields; | |
| 83 | } | |
| 84 | } |