| 1 | <?php |
||
| 19 | class ArticleExtraEmbedField extends ArticleExtraField implements ArticleExtraEmbedFieldInterface |
||
| 20 | { |
||
| 21 | protected ?string $embed; |
||
|
|
|||
| 22 | |||
| 23 | protected ?string $description; |
||
| 24 | |||
| 25 | public static function newFromValue(string $fieldName, array $value): ArticleExtraEmbedFieldInterface |
||
| 26 | { |
||
| 27 | $extra = new self(); |
||
| 28 | |||
| 29 | $extra->setFieldName($fieldName); |
||
| 30 | $extra->setEmbed($value['embed']); |
||
| 31 | $extra->setDescription($value['description']); |
||
| 32 | |||
| 33 | return $extra; |
||
| 34 | } |
||
| 35 | |||
| 36 | public function setEmbed(?string $embed): void |
||
| 37 | { |
||
| 38 | $this->embed = $embed; |
||
| 39 | } |
||
| 40 | |||
| 41 | public function getEmbed(): ?string |
||
| 42 | { |
||
| 43 | return $this->embed; |
||
| 44 | } |
||
| 45 | |||
| 46 | public function setDescription(?string $description): void |
||
| 47 | { |
||
| 48 | $this->description = $description; |
||
| 49 | } |
||
| 50 | |||
| 51 | public function getDescription(): ?string |
||
| 52 | { |
||
| 53 | return $this->description; |
||
| 54 | } |
||
| 55 | |||
| 56 | public function toApiFormat(): array |
||
| 57 | { |
||
| 58 | return [ |
||
| 59 | 'embed' => $this->embed, |
||
| 60 | 'description' => $this->description, |
||
| 61 | ]; |
||
| 62 | } |
||
| 63 | } |
||
| 64 |