Carbon::now()->toIso8601String(), 'ok' => $ok, // Never the password, never the whole exception: this ends up on a // page, and an IMAP error can quote the command it failed on. 'message' => mb_substr($message, 0, 300), 'unseen' => $unseen, ]); } /** * The last answer, or null if nobody has ever asked. * * @return array{at: Carbon, ok: bool, message: string, unseen: int|null}|null */ public function last(): ?array { $row = Settings::get(self::KEY); if (! is_array($row) || ! isset($row['at'])) { return null; } return [ // Parsed back into a Carbon so the view can put it on the wall clock // (R19) rather than printing an ISO string at somebody. 'at' => Carbon::parse((string) $row['at']), 'ok' => (bool) ($row['ok'] ?? false), 'message' => (string) ($row['message'] ?? ''), 'unseen' => isset($row['unseen']) ? (int) $row['unseen'] : null, ]; } }