| @@ 13-84 (lines=72) @@ | ||
| 10 | /** |
|
| 11 | * Class ArticleTranslationMessage |
|
| 12 | */ |
|
| 13 | class ArticleTranslationMessage implements MessageInterface |
|
| 14 | { |
|
| 15 | use LocaleAwareMessageTrait; |
|
| 16 | ||
| 17 | /** |
|
| 18 | * @var string |
|
| 19 | */ |
|
| 20 | private $title = ''; |
|
| 21 | ||
| 22 | /** |
|
| 23 | * @var string|null |
|
| 24 | */ |
|
| 25 | private $body; |
|
| 26 | ||
| 27 | /** |
|
| 28 | * @param ArticleTranslation $translation |
|
| 29 | * |
|
| 30 | * @return self |
|
| 31 | */ |
|
| 32 | public static function createFromArticleTranslation(ArticleTranslation $translation): self |
|
| 33 | { |
|
| 34 | $message = new self(); |
|
| 35 | $message->setLocale($translation->getLocale()); |
|
| 36 | $message->setTitle($translation->getTitle()); |
|
| 37 | $message->setBody($translation->getBody()); |
|
| 38 | ||
| 39 | return $message; |
|
| 40 | } |
|
| 41 | ||
| 42 | /** |
|
| 43 | * @return string |
|
| 44 | */ |
|
| 45 | public function getTitle(): string |
|
| 46 | { |
|
| 47 | return $this->title; |
|
| 48 | } |
|
| 49 | ||
| 50 | /** |
|
| 51 | * @param string $title |
|
| 52 | */ |
|
| 53 | public function setTitle(string $title) |
|
| 54 | { |
|
| 55 | $this->title = $title; |
|
| 56 | } |
|
| 57 | ||
| 58 | /** |
|
| 59 | * @return null|string |
|
| 60 | */ |
|
| 61 | public function getBody() |
|
| 62 | { |
|
| 63 | return $this->body; |
|
| 64 | } |
|
| 65 | ||
| 66 | /** |
|
| 67 | * @param null|string $body |
|
| 68 | */ |
|
| 69 | public function setBody(string $body = null) |
|
| 70 | { |
|
| 71 | $this->body = $body; |
|
| 72 | } |
|
| 73 | ||
| 74 | /** |
|
| 75 | * {@inheritdoc} |
|
| 76 | */ |
|
| 77 | public function build() |
|
| 78 | { |
|
| 79 | return [ |
|
| 80 | 'title' => $this->getTitle(), |
|
| 81 | 'body' => $this->getBody(), |
|
| 82 | ]; |
|
| 83 | } |
|
| 84 | } |
|
| 85 | ||
| @@ 13-84 (lines=72) @@ | ||
| 10 | /** |
|
| 11 | * Class CategoryTranslationMessage |
|
| 12 | */ |
|
| 13 | class CategoryTranslationMessage implements MessageInterface |
|
| 14 | { |
|
| 15 | use LocaleAwareMessageTrait; |
|
| 16 | ||
| 17 | /** |
|
| 18 | * @var string |
|
| 19 | */ |
|
| 20 | private $title; |
|
| 21 | ||
| 22 | /** |
|
| 23 | * @var string|null |
|
| 24 | */ |
|
| 25 | private $description; |
|
| 26 | ||
| 27 | /** |
|
| 28 | * @param CategoryTranslation $translation |
|
| 29 | * |
|
| 30 | * @return self |
|
| 31 | */ |
|
| 32 | public static function createFromCategoryTranslation(CategoryTranslation $translation): self |
|
| 33 | { |
|
| 34 | $message = new self(); |
|
| 35 | $message->setLocale($translation->getLocale()); |
|
| 36 | $message->setTitle($translation->getTitle()); |
|
| 37 | $message->setDescription($translation->getDescription()); |
|
| 38 | ||
| 39 | return $message; |
|
| 40 | } |
|
| 41 | ||
| 42 | /** |
|
| 43 | * @return string |
|
| 44 | */ |
|
| 45 | public function getTitle(): string |
|
| 46 | { |
|
| 47 | return $this->title; |
|
| 48 | } |
|
| 49 | ||
| 50 | /** |
|
| 51 | * @param string $title |
|
| 52 | */ |
|
| 53 | public function setTitle(string $title) |
|
| 54 | { |
|
| 55 | $this->title = $title; |
|
| 56 | } |
|
| 57 | ||
| 58 | /** |
|
| 59 | * @return null|string |
|
| 60 | */ |
|
| 61 | public function getDescription() |
|
| 62 | { |
|
| 63 | return $this->description; |
|
| 64 | } |
|
| 65 | ||
| 66 | /** |
|
| 67 | * @param null|string $description |
|
| 68 | */ |
|
| 69 | public function setDescription(string $description = null) |
|
| 70 | { |
|
| 71 | $this->description = $description; |
|
| 72 | } |
|
| 73 | ||
| 74 | /** |
|
| 75 | * {@inheritdoc} |
|
| 76 | */ |
|
| 77 | public function build() |
|
| 78 | { |
|
| 79 | return [ |
|
| 80 | 'title' => $this->getTitle(), |
|
| 81 | 'description' => $this->getDescription(), |
|
| 82 | ]; |
|
| 83 | } |
|
| 84 | } |
|
| 85 | ||
| @@ 13-84 (lines=72) @@ | ||
| 10 | /** |
|
| 11 | * Class LocationTranslationMessage |
|
| 12 | */ |
|
| 13 | class LocationTranslationMessage implements MessageInterface |
|
| 14 | { |
|
| 15 | use LocaleAwareMessageTrait; |
|
| 16 | ||
| 17 | /** |
|
| 18 | * @var string |
|
| 19 | */ |
|
| 20 | private $title; |
|
| 21 | ||
| 22 | /** |
|
| 23 | * @var string|null |
|
| 24 | */ |
|
| 25 | private $openingHours; |
|
| 26 | ||
| 27 | /** |
|
| 28 | * @param LocationTranslation $translation |
|
| 29 | * |
|
| 30 | * @return self |
|
| 31 | */ |
|
| 32 | public static function createFromLocationTranslation(LocationTranslation $translation): self |
|
| 33 | { |
|
| 34 | $message = new self(); |
|
| 35 | $message->setLocale($translation->getLocale()); |
|
| 36 | $message->setTitle($translation->getTitle()); |
|
| 37 | $message->setOpeningHours($translation->getOpeningHours()); |
|
| 38 | ||
| 39 | return $message; |
|
| 40 | } |
|
| 41 | ||
| 42 | /** |
|
| 43 | * @return string |
|
| 44 | */ |
|
| 45 | public function getTitle(): string |
|
| 46 | { |
|
| 47 | return $this->title; |
|
| 48 | } |
|
| 49 | ||
| 50 | /** |
|
| 51 | * @param string $title |
|
| 52 | */ |
|
| 53 | public function setTitle(string $title) |
|
| 54 | { |
|
| 55 | $this->title = $title; |
|
| 56 | } |
|
| 57 | ||
| 58 | /** |
|
| 59 | * @return null|string |
|
| 60 | */ |
|
| 61 | public function getOpeningHours() |
|
| 62 | { |
|
| 63 | return $this->openingHours; |
|
| 64 | } |
|
| 65 | ||
| 66 | /** |
|
| 67 | * @param null|string $openingHours |
|
| 68 | */ |
|
| 69 | public function setOpeningHours($openingHours) |
|
| 70 | { |
|
| 71 | $this->openingHours = $openingHours; |
|
| 72 | } |
|
| 73 | ||
| 74 | /** |
|
| 75 | * {@inheritdoc} |
|
| 76 | */ |
|
| 77 | public function build() |
|
| 78 | { |
|
| 79 | return [ |
|
| 80 | 'title' => $this->getTitle(), |
|
| 81 | 'openingHours' => $this->getOpeningHours(), |
|
| 82 | ]; |
|
| 83 | } |
|
| 84 | } |
|
| 85 | ||