Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 33 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
DraftTranslationDTO | |
0.00% |
0 / 33 |
|
0.00% |
0 / 2 |
12 | |
0.00% |
0 / 1 |
__construct | |
0.00% |
0 / 17 |
|
0.00% |
0 / 1 |
6 | |||
toArray | |
0.00% |
0 / 16 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | |
3 | declare( strict_types = 1 ); |
4 | |
5 | namespace ContentTranslation\DTO; |
6 | |
7 | /** |
8 | * Unlike the Entity\SectionTranslation class that is mapped to the |
9 | * "cx_section_translations" database table, this DTO class is tuned |
10 | * for exporting draft translation data to views. |
11 | */ |
12 | class DraftTranslationDTO extends AbstractTranslationDTO { |
13 | private ?int $sectionTranslationId; |
14 | private ?string $sectionId; |
15 | private string $status; |
16 | private ?string $sourceSectionTitle; |
17 | private ?string $targetSectionTitle; |
18 | private ?array $progress; |
19 | |
20 | public function __construct( |
21 | ?int $sectionTranslationId, |
22 | int $translationId, |
23 | ?string $sectionId, |
24 | string $sourceTitle, |
25 | string $sourceLanguage, |
26 | string $targetLanguage, |
27 | string $startTimestamp, |
28 | string $lastUpdatedTimestamp, |
29 | string $status, |
30 | string $pageRevision, |
31 | ?string $progress, |
32 | ?string $targetTitle, |
33 | ?string $sourceSectionTitle, |
34 | ?string $targetSectionTitle |
35 | ) { |
36 | parent::__construct( |
37 | $translationId, |
38 | $sourceTitle, |
39 | $sourceLanguage, |
40 | $targetLanguage, |
41 | $startTimestamp, |
42 | $lastUpdatedTimestamp, |
43 | $pageRevision, |
44 | $targetTitle |
45 | ); |
46 | $this->sectionTranslationId = $sectionTranslationId; |
47 | $this->sectionId = $sectionId; |
48 | $this->status = $status; |
49 | $this->sourceSectionTitle = $sourceSectionTitle; |
50 | $this->targetSectionTitle = $targetSectionTitle; |
51 | $progress = $progress ? json_decode( $progress, true ) : null; |
52 | $this->progress = $progress; |
53 | } |
54 | |
55 | public function toArray(): array { |
56 | return [ |
57 | "sectionTranslationId" => $this->sectionTranslationId, |
58 | "translationId" => $this->translationId, |
59 | "sectionId" => $this->sectionId, |
60 | "sourceTitle" => $this->sourceTitle, |
61 | "sourceLanguage" => $this->sourceLanguage, |
62 | "targetLanguage" => $this->targetLanguage, |
63 | "startTimestamp" => $this->startTimestamp, |
64 | "lastUpdatedTimestamp" => $this->lastUpdatedTimestamp, |
65 | "status" => $this->status, |
66 | "pageRevision" => $this->pageRevision, |
67 | "targetTitle" => $this->targetTitle, |
68 | "sourceSectionTitle" => $this->sourceSectionTitle, |
69 | "targetSectionTitle" => $this->targetSectionTitle, |
70 | "progress" => $this->progress, |
71 | ]; |
72 | } |
73 | } |