From 57dc1d29b3bbb8c7abcdd27681bd9230ab375e42 Mon Sep 17 00:00:00 2001 From: the-djmaze <> Date: Sun, 12 Feb 2023 18:27:55 +0100 Subject: [PATCH] Update Identity class to latest PHP features --- .../app/libraries/RainLoop/Model/Identity.php | 78 +++++-------------- 1 file changed, 21 insertions(+), 57 deletions(-) diff --git a/snappymail/v/0.0.0/app/libraries/RainLoop/Model/Identity.php b/snappymail/v/0.0.0/app/libraries/RainLoop/Model/Identity.php index 9029fd5f6..45ddf142d 100644 --- a/snappymail/v/0.0.0/app/libraries/RainLoop/Model/Identity.php +++ b/snappymail/v/0.0.0/app/libraries/RainLoop/Model/Identity.php @@ -6,50 +6,24 @@ use MailSo\Base\Utils; class Identity implements \JsonSerializable { - /** - * @var string - */ - private $sId; + private string $sId; - /** - * @var string - */ - private $sEmail; + private string $sEmail; - /** - * @var string - */ - private $sName; + private string $sName = ''; - /** - * @var string - */ - private $sReplyTo; + private string $sReplyTo = ''; - /** - * @var string - */ - private $sBcc; + private string $sBcc = ''; - /** - * @var string - */ - private $sSignature; + private string $sSignature = ''; - /** - * @var bool - */ - private $bSignatureInsertBefore; + private bool $bSignatureInsertBefore = false; function __construct(string $sId = '', string $sEmail = '') { $this->sId = $sId; $this->sEmail = $sEmail; - $this->sName = ''; - $this->sReplyTo = ''; - $this->sBcc = ''; - $this->sSignature = ''; - $this->bSignatureInsertBefore = false; } public function Id(bool $bFillOnEmpty = false): string @@ -84,16 +58,6 @@ class Identity implements \JsonSerializable return $this->sBcc; } - public function Signature(): string - { - return $this->sSignature; - } - - public function SignatureInsertBefore(): bool - { - return $this->bSignatureInsertBefore; - } - public function SetId(string $sId): Identity { $this->sId = $sId; @@ -151,13 +115,13 @@ class Identity implements \JsonSerializable public function ToSimpleJSON(): array { return array( - 'Id' => $this->Id(), - 'Email' => $this->Email(), - 'Name' => $this->Name(), - 'ReplyTo' => $this->ReplyTo(), - 'Bcc' => $this->Bcc(), - 'Signature' => $this->Signature(), - 'SignatureInsertBefore' => $this->SignatureInsertBefore() + 'Id' => $this->sId, + 'Email' => $this->sEmail, + 'Name' => $this->sName, + 'ReplyTo' => $this->sReplyTo, + 'Bcc' => $this->sBcc, + 'Signature' => $this->sSignature, + 'SignatureInsertBefore' => $this->bSignatureInsertBefore ); } @@ -165,13 +129,13 @@ class Identity implements \JsonSerializable public function jsonSerialize() { return array( - 'Id' => $this->Id(), - 'Email' => Utils::IdnToUtf8($this->Email()), - 'Name' => $this->Name(), - 'ReplyTo' => $this->ReplyTo(), - 'Bcc' => $this->Bcc(), - 'Signature' => $this->Signature(), - 'SignatureInsertBefore' => $this->SignatureInsertBefore() + 'Id' => $this->sId, + 'Email' => Utils::IdnToUtf8($this->sEmail), + 'Name' => $this->sName, + 'ReplyTo' => $this->sReplyTo, + 'Bcc' => $this->sBcc, + 'Signature' => $this->sSignature, + 'SignatureInsertBefore' => $this->bSignatureInsertBefore ); }