id = (int)$mail['id']; $this->created_at = DateTimeFormat::utc($mail['created'] ?? 'now', DateTimeFormat::API); $this->title = $title; $this->text = $text; $this->sender = $sender->toArray(); $this->recipient = $recipient->toArray(); $this->sender_id = (int)$this->sender['id']; $this->recipient_id = (int)$this->recipient['id']; $this->sender_screen_name = $this->sender['screen_name']; $this->recipient_screen_name = $this->recipient['screen_name']; $this->friendica_seen = (bool)$mail['seen'] ?? false; $this->friendica_parent_uri = $mail['parent-uri'] ?? ''; } /** * Returns the current entity as an array * * @return array */ public function toArray(): array { $status = parent::toArray(); if (is_null($status['title'])) { unset($status['title']); } unset($status['sender']['uid']); unset($status['recipient']['uid']); return $status; } }