*/ protected function casts(): array { return [ 'password' => 'encrypted', 'is_active' => 'boolean', 'port' => 'integer', 'last_fetched_at' => 'immutable_datetime', ]; } public function readsEverything(): bool { return $this->mode === self::FULL; } /** * Connection data in the form the reader expects, or null when it is not usable. * * @return array{host: string, port: int, encryption: string, username: string, password: ?string, folder: string}|null */ public function connection(): ?array { if (blank($this->host) || blank($this->username)) { return null; } return [ 'host' => (string) $this->host, 'port' => (int) ($this->port ?: 993), 'encryption' => (string) ($this->encryption ?: 'ssl'), 'username' => (string) $this->username, 'password' => $this->password, 'folder' => (string) ($this->folder ?: 'INBOX'), ]; } }