feat: implement entity mutable interface

Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
2026-05-09 17:03:58 -04:00
parent d9bc526126
commit 086d7a1366
3 changed files with 134 additions and 38 deletions

View File

@@ -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;
}
}