Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
31.25% |
5 / 16 |
|
83.33% |
5 / 6 |
CRAP | |
0.00% |
0 / 1 |
| TranslateImageGalleryJob | |
31.25% |
5 / 16 |
|
83.33% |
5 / 6 |
17.70 | |
0.00% |
0 / 1 |
| getJobType | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getTableAlias | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getRequiredArguments | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getDisplayNameArgument | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getEntityTypeName | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getFieldsForTranslation | |
0.00% |
0 / 11 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | declare(strict_types=1); |
| 3 | |
| 4 | namespace App\Job; |
| 5 | |
| 6 | use Cake\Datasource\EntityInterface; |
| 7 | |
| 8 | /** |
| 9 | * TranslateImageGalleryJob Class |
| 10 | * |
| 11 | * Job for translating image gallery content using the Google Translate API. |
| 12 | */ |
| 13 | class TranslateImageGalleryJob extends AbstractTranslateJob |
| 14 | { |
| 15 | /** |
| 16 | * @inheritDoc |
| 17 | */ |
| 18 | protected static function getJobType(): string |
| 19 | { |
| 20 | return 'image gallery translation'; |
| 21 | } |
| 22 | |
| 23 | /** |
| 24 | * @inheritDoc |
| 25 | */ |
| 26 | protected function getTableAlias(): string |
| 27 | { |
| 28 | return 'ImageGalleries'; |
| 29 | } |
| 30 | |
| 31 | /** |
| 32 | * @inheritDoc |
| 33 | */ |
| 34 | protected function getRequiredArguments(): array |
| 35 | { |
| 36 | return ['id', 'name']; |
| 37 | } |
| 38 | |
| 39 | /** |
| 40 | * @inheritDoc |
| 41 | */ |
| 42 | protected function getDisplayNameArgument(): string |
| 43 | { |
| 44 | return 'name'; |
| 45 | } |
| 46 | |
| 47 | /** |
| 48 | * @inheritDoc |
| 49 | */ |
| 50 | protected function getEntityTypeName(): string |
| 51 | { |
| 52 | return 'Gallery'; |
| 53 | } |
| 54 | |
| 55 | /** |
| 56 | * @inheritDoc |
| 57 | */ |
| 58 | protected function getFieldsForTranslation(EntityInterface $entity): array |
| 59 | { |
| 60 | return [ |
| 61 | 'name' => (string)$entity->name, |
| 62 | 'description' => (string)$entity->description, |
| 63 | 'meta_title' => (string)$entity->meta_title, |
| 64 | 'meta_description' => (string)$entity->meta_description, |
| 65 | 'meta_keywords' => (string)$entity->meta_keywords, |
| 66 | 'facebook_description' => (string)$entity->facebook_description, |
| 67 | 'linkedin_description' => (string)$entity->linkedin_description, |
| 68 | 'instagram_description' => (string)$entity->instagram_description, |
| 69 | 'twitter_description' => (string)$entity->twitter_description, |
| 70 | ]; |
| 71 | } |
| 72 | } |