Update Identity class to latest PHP features

This commit is contained in:
the-djmaze 2023-02-12 18:27:55 +01:00
parent 396a1a423e
commit 57dc1d29b3

View file

@ -6,50 +6,24 @@ use MailSo\Base\Utils;
class Identity implements \JsonSerializable class Identity implements \JsonSerializable
{ {
/** private string $sId;
* @var string
*/
private $sId;
/** private string $sEmail;
* @var string
*/
private $sEmail;
/** private string $sName = '';
* @var string
*/
private $sName;
/** private string $sReplyTo = '';
* @var string
*/
private $sReplyTo;
/** private string $sBcc = '';
* @var string
*/
private $sBcc;
/** private string $sSignature = '';
* @var string
*/
private $sSignature;
/** private bool $bSignatureInsertBefore = false;
* @var bool
*/
private $bSignatureInsertBefore;
function __construct(string $sId = '', string $sEmail = '') function __construct(string $sId = '', string $sEmail = '')
{ {
$this->sId = $sId; $this->sId = $sId;
$this->sEmail = $sEmail; $this->sEmail = $sEmail;
$this->sName = '';
$this->sReplyTo = '';
$this->sBcc = '';
$this->sSignature = '';
$this->bSignatureInsertBefore = false;
} }
public function Id(bool $bFillOnEmpty = false): string public function Id(bool $bFillOnEmpty = false): string
@ -84,16 +58,6 @@ class Identity implements \JsonSerializable
return $this->sBcc; return $this->sBcc;
} }
public function Signature(): string
{
return $this->sSignature;
}
public function SignatureInsertBefore(): bool
{
return $this->bSignatureInsertBefore;
}
public function SetId(string $sId): Identity public function SetId(string $sId): Identity
{ {
$this->sId = $sId; $this->sId = $sId;
@ -151,13 +115,13 @@ class Identity implements \JsonSerializable
public function ToSimpleJSON(): array public function ToSimpleJSON(): array
{ {
return array( return array(
'Id' => $this->Id(), 'Id' => $this->sId,
'Email' => $this->Email(), 'Email' => $this->sEmail,
'Name' => $this->Name(), 'Name' => $this->sName,
'ReplyTo' => $this->ReplyTo(), 'ReplyTo' => $this->sReplyTo,
'Bcc' => $this->Bcc(), 'Bcc' => $this->sBcc,
'Signature' => $this->Signature(), 'Signature' => $this->sSignature,
'SignatureInsertBefore' => $this->SignatureInsertBefore() 'SignatureInsertBefore' => $this->bSignatureInsertBefore
); );
} }
@ -165,13 +129,13 @@ class Identity implements \JsonSerializable
public function jsonSerialize() public function jsonSerialize()
{ {
return array( return array(
'Id' => $this->Id(), 'Id' => $this->sId,
'Email' => Utils::IdnToUtf8($this->Email()), 'Email' => Utils::IdnToUtf8($this->sEmail),
'Name' => $this->Name(), 'Name' => $this->sName,
'ReplyTo' => $this->ReplyTo(), 'ReplyTo' => $this->sReplyTo,
'Bcc' => $this->Bcc(), 'Bcc' => $this->sBcc,
'Signature' => $this->Signature(), 'Signature' => $this->sSignature,
'SignatureInsertBefore' => $this->SignatureInsertBefore() 'SignatureInsertBefore' => $this->bSignatureInsertBefore
); );
} }