$items */ public function __construct( private readonly string $mailbox, private readonly array $items, ) {} public function mailbox(): string { return $this->mailbox; } /** * @return array */ public function items(): array { return $this->items; } public function value(string $item, int $default = 0): int { return $this->items[strtoupper(trim($item))] ?? $default; } public function messages(): int { return $this->value('MESSAGES'); } public function unseen(): int { return $this->value('UNSEEN'); } public function read(): int { return max(0, $this->messages() - $this->unseen()); } public function state(): int { return $this->value('UIDVALIDITY'); } }