| Total Complexity | 5 | 
| Total Lines | 47 | 
| Duplicated Lines | 0 % | 
| Changes | 0 | ||
| 1 | <?php | ||
| 14 | class RichTextEmailAddress extends RichText | ||
| 15 | { | ||
| 16 | public const TYPE_NAME = 'richTextEmailAddress'; | ||
| 17 | |||
| 18 | /** | ||
| 19 | * Text. | ||
| 20 | */ | ||
| 21 | protected RichText $text; | ||
| 22 | |||
| 23 | /** | ||
| 24 | * Email address. | ||
| 25 | */ | ||
| 26 | protected string $emailAddress; | ||
| 27 | |||
| 28 | public function __construct(RichText $text, string $emailAddress) | ||
| 29 |     { | ||
| 30 | parent::__construct(); | ||
| 31 | |||
| 32 | $this->text = $text; | ||
| 33 | $this->emailAddress = $emailAddress; | ||
| 34 | } | ||
| 35 | |||
| 36 | public static function fromArray(array $array): RichTextEmailAddress | ||
| 37 |     { | ||
| 38 | return new static( | ||
| 39 | TdSchemaRegistry::fromArray($array['text']), | ||
| 40 | $array['email_address'], | ||
| 41 | ); | ||
| 42 | } | ||
| 43 | |||
| 44 | public function typeSerialize(): array | ||
| 45 |     { | ||
| 46 | return [ | ||
| 47 | '@type' => static::TYPE_NAME, | ||
| 48 | 'text' => $this->text->typeSerialize(), | ||
| 49 | 'email_address' => $this->emailAddress, | ||
| 50 | ]; | ||
| 51 | } | ||
| 52 | |||
| 53 | public function getText(): RichText | ||
| 54 |     { | ||
| 55 | return $this->text; | ||
| 56 | } | ||
| 57 | |||
| 58 | public function getEmailAddress(): string | ||
| 61 | } | ||
| 62 | } | ||
| 63 |