generated from Nodarx/template
feat: implement entity mutable interface
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
@@ -112,20 +112,33 @@ class MessageProperties extends MessagePropertiesMutableAbstract {
|
||||
return $this;
|
||||
}
|
||||
|
||||
private static function normalizeFlag(string $flag): string
|
||||
public function toImap(): array
|
||||
{
|
||||
$flag = ltrim($flag, '\\');
|
||||
$message = [];
|
||||
|
||||
return match (strtolower($flag)) {
|
||||
'seen' => 'read',
|
||||
'flagged' => 'flagged',
|
||||
'answered' => 'answered',
|
||||
'draft' => 'draft',
|
||||
'deleted' => 'deleted',
|
||||
default => strtolower($flag),
|
||||
};
|
||||
if (isset($this->data['flags'])) {
|
||||
$message['flags'] = $this->data['flags'];
|
||||
}
|
||||
|
||||
return $message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Hydrate from store array
|
||||
*/
|
||||
public function fromStore(array $data): static {
|
||||
$this->data = $data;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Serialize to store array
|
||||
*/
|
||||
public function toStore(): array {
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Convert a string to UTF-8 from the given charset.
|
||||
*
|
||||
@@ -181,18 +194,4 @@ class MessageProperties extends MessagePropertiesMutableAbstract {
|
||||
$attachments[] = $part->toArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* Serialize to store array
|
||||
*/
|
||||
public function toStore(): array {
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Hydrate from store array
|
||||
*/
|
||||
public function fromStore(array $data): static {
|
||||
$this->data = $data;
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user