setConnection($connection) ->setLogger($logger); } protected array $mailboxes; public function getAll(): array { if (!isset($this->mailboxes)) { $this->mailboxes = $this->getConnection()->getMailboxes(); } return $this->mailboxes; } /** * @throws Invalid */ public function get(string $mailbox_name): MailboxInterface { if (!$this->getConnection()->hasMailbox($mailbox_name)) { throw new Invalid($mailbox_name); } return $this->getConnection()->getMailbox($mailbox_name); } public function validate(string $mailbox_name, int $uidvalidity): bool { $mailbox = $this->get($mailbox_name); return ($mailbox->getStatus()->uidvalidity === $uidvalidity); } }