* @psalm-var self::TYPE_* */ protected $type; /** @var int */ protected $accountId; /** @var int|null */ protected $aliasId; /** @var int */ protected $sendAt; /** @var string */ protected $subject; /** @var string|null */ protected $bodyPlain; /** @var string|null */ protected $bodyHtml; /** @var string|null */ protected $editorBody; /** @var bool */ protected $html; /** @var string|null */ protected $inReplyToMessageId; /** @var array|null */ protected $attachments; /** @var array|null */ protected $recipients; /** @var bool|null */ protected $failed; /** @var int|null */ protected $updatedAt; /** @var bool|null */ protected $pgpMime; /** @var bool|null */ protected $smimeSign; /** @var int|null */ protected $smimeCertificateId; /** @var bool|null */ protected $smimeEncrypt; /** * @var int|null * @psalm-var int-mask-of */ protected $status; /** @var string|null */ protected $raw; /** @var bool */ protected $requestMdn; public function __construct() { $this->addType('type', 'integer'); $this->addType('accountId', 'integer'); $this->addType('aliasId', 'integer'); $this->addType('sendAt', 'integer'); $this->addType('html', 'boolean'); $this->addType('failed', 'boolean'); $this->addType('updatedAt', 'integer'); $this->addType('pgpMime', 'boolean'); $this->addType('smimeSign', 'boolean'); $this->addType('smimeCertificateId', 'integer'); $this->addType('smimeEncrypt', 'boolean'); $this->addType('status', 'integer'); $this->addType('requestMdn', 'boolean'); } #[\Override] #[ReturnTypeWillChange] public function jsonSerialize() { return [ 'id' => $this->getId(), 'type' => $this->getType(), 'accountId' => $this->getAccountId(), 'aliasId' => $this->getAliasId(), 'sendAt' => $this->getSendAt(), 'updatedAt' => $this->getUpdatedAt(), 'subject' => $this->getSubject(), 'bodyPlain' => $this->getBodyPlain(), 'bodyHtml' => $this->getBodyHtml(), 'editorBody' => $this->getEditorBody(), 'isHtml' => ($this->isHtml() === true), 'isPgpMime' => ($this->isPgpMime() === true), 'inReplyToMessageId' => $this->getInReplyToMessageId(), 'attachments' => $this->getAttachments(), 'from' => array_values( array_filter($this->getRecipients(), static fn (Recipient $recipient) => $recipient->getType() === Recipient::TYPE_FROM) ), 'to' => array_values( array_filter($this->getRecipients(), static fn (Recipient $recipient) => $recipient->getType() === Recipient::TYPE_TO) ), 'cc' => array_values( array_filter($this->getRecipients(), static fn (Recipient $recipient) => $recipient->getType() === Recipient::TYPE_CC) ), 'bcc' => array_values( array_filter($this->getRecipients(), static fn (Recipient $recipient) => $recipient->getType() === Recipient::TYPE_BCC) ), 'failed' => $this->isFailed() === true, 'smimeCertificateId' => $this->getSmimeCertificateId(), 'smimeSign' => $this->getSmimeSign() === true, 'smimeEncrypt' => $this->getSmimeEncrypt() === true, 'status' => $this->getStatus(), 'raw' => $this->getRaw(), 'requestMdn' => $this->getRequestMdn(), ]; } /** * @param LocalAttachment[] $attachments * @return void */ public function setAttachments(array $attachments): void { $this->attachments = $attachments; } /** * @return LocalAttachment[]|null */ public function getAttachments(): ?array { return $this->attachments; } /** * @param Recipient[] $recipients * @return void */ public function setRecipients(array $recipients): void { $this->recipients = $recipients; } /** * @return Recipient[]|null */ public function getRecipients(): ?array { return $this->recipients; } }