setId($params['accountId']); } if (isset($params['accountName'])) { $this->setName($params['accountName']); } if (isset($params['emailAddress'])) { $this->setEmail($params['emailAddress']); } if (isset($params['imapHost'])) { $this->setInboundHost($params['imapHost']); } if (isset($params['imapPort'])) { $this->setInboundPort($params['imapPort']); } if (isset($params['imapSslMode'])) { $this->setInboundSslMode($params['imapSslMode']); } if (isset($params['imapUser'])) { $this->setInboundUser($params['imapUser']); } if (isset($params['imapPassword'])) { $this->setInboundPassword($params['imapPassword']); } if (isset($params['smtpHost'])) { $this->setOutboundHost($params['smtpHost']); } if (isset($params['smtpPort'])) { $this->setOutboundPort($params['smtpPort']); } if (isset($params['smtpSslMode'])) { $this->setOutboundSslMode($params['smtpSslMode']); } if (isset($params['smtpUser'])) { $this->setOutboundUser($params['smtpUser']); } if (isset($params['smtpPassword'])) { $this->setOutboundPassword($params['smtpPassword']); } if (isset($params['showSubscribedOnly'])) { $this->setShowSubscribedOnly($params['showSubscribedOnly']); } if (isset($params['signatureAboveQuote'])) { $this->setSignatureAboveQuote($params['signatureAboveQuote']); } if (isset($params['trashRetentionDays'])) { $this->setTrashRetentionDays($params['trashRetentionDays']); } if (isset($params['outOfOfficeFollowsSystem'])) { $this->setOutOfOfficeFollowsSystem($params['outOfOfficeFollowsSystem']); } if (isset($params['debug'])) { $this->setDebug($params['debug']); } $this->addType('inboundPort', 'integer'); $this->addType('outboundPort', 'integer'); $this->addType('lastMailboxSync', 'integer'); $this->addType('provisioningId', 'integer'); $this->addType('order', 'integer'); $this->addType('showSubscribedOnly', 'boolean'); $this->addType('personalNamespace', 'string'); $this->addType('draftsMailboxId', 'integer'); $this->addType('sentMailboxId', 'integer'); $this->addType('trashMailboxId', 'integer'); $this->addType('archiveMailboxId', 'integer'); $this->addType('snoozeMailboxId', 'integer'); $this->addType('sieveEnabled', 'boolean'); $this->addType('sievePort', 'integer'); $this->addType('signatureAboveQuote', 'boolean'); $this->addType('signatureMode', 'integer'); $this->addType('smimeCertificateId', 'integer'); $this->addType('quotaPercentage', 'integer'); $this->addType('trashRetentionDays', 'integer'); $this->addType('junkMailboxId', 'integer'); $this->addType('searchBody', 'boolean'); $this->addType('oooFollowsSystem', 'boolean'); $this->addType('debug', 'boolean'); } public function getOutOfOfficeFollowsSystem(): bool { return $this->getOooFollowsSystem() === true; } public function setOutOfOfficeFollowsSystem(bool $outOfOfficeFollowsSystem): void { $this->setOooFollowsSystem($outOfOfficeFollowsSystem); } public function canAuthenticateImap(): bool { return isset($this->inboundPassword) || isset($this->oauthAccessToken); } /** * @return array */ public function toJson() { $result = [ 'id' => $this->getId(), 'accountId' => $this->getId(), 'name' => $this->getName(), 'order' => $this->getOrder(), 'emailAddress' => $this->getEmail(), 'imapHost' => $this->getInboundHost(), 'imapPort' => $this->getInboundPort(), 'imapUser' => $this->getInboundUser(), 'imapSslMode' => $this->getInboundSslMode(), 'signature' => $this->getSignature(), 'editorMode' => $this->getEditorMode(), 'provisioningId' => $this->getProvisioningId(), 'showSubscribedOnly' => ($this->getShowSubscribedOnly() === true), 'personalNamespace' => $this->getPersonalNamespace(), 'draftsMailboxId' => $this->getDraftsMailboxId(), 'sentMailboxId' => $this->getSentMailboxId(), 'trashMailboxId' => $this->getTrashMailboxId(), 'archiveMailboxId' => $this->getArchiveMailboxId(), 'snoozeMailboxId' => $this->getSnoozeMailboxId(), 'sieveEnabled' => ($this->isSieveEnabled() === true), 'signatureAboveQuote' => ($this->isSignatureAboveQuote() === true), 'signatureMode' => $this->getSignatureMode(), 'smimeCertificateId' => $this->getSmimeCertificateId(), 'quotaPercentage' => $this->getQuotaPercentage(), 'trashRetentionDays' => $this->getTrashRetentionDays(), 'junkMailboxId' => $this->getJunkMailboxId(), 'searchBody' => $this->getSearchBody(), 'outOfOfficeFollowsSystem' => $this->getOutOfOfficeFollowsSystem(), 'debug' => $this->getDebug(), ]; if (!is_null($this->getOutboundHost())) { $result['smtpHost'] = $this->getOutboundHost(); $result['smtpPort'] = $this->getOutboundPort(); $result['smtpUser'] = $this->getOutboundUser(); $result['smtpSslMode'] = $this->getOutboundSslMode(); } if ($this->isSieveEnabled()) { $result['sieveHost'] = $this->getSieveHost(); $result['sievePort'] = $this->getSievePort(); $result['sieveUser'] = $this->getSieveUser(); $result['sieveSslMode'] = $this->getSieveSslMode(); } return $result; } }