subject = $subject; $this->body = $body; $this->isHtml = $isHtml; $this->attachmentList = $attachmentList; } public function getSubject(): string { return $this->subject; } public function getBody(): string { return $this->body; } public function isHtml(): bool { return $this->isHtml; } /** * @return Attachment[] */ public function getAttachmentList(): array { return $this->attachmentList; } /** * @return string[] */ public function getAttachmentIdList(): array { $list = []; foreach ($this->attachmentList as $attachment) { $list[] = $attachment->getId(); } return $list; } public function getValueMap(): stdClass { $attachmentsIds = []; $attachmentsNames = (object) []; foreach ($this->attachmentList as $attachment) { $id = $attachment->getId(); $attachmentsIds[] = $id; $attachmentsNames->$id = $attachment->get('name'); } return (object) [ 'subject' => $this->subject, 'body' => $this->body, 'isHtml' => $this->isHtml, 'attachmentsIds' => $attachmentsIds, 'attachmentsNames' => $attachmentsNames, ]; } }