From d51e2652725648d314e4e4498de72375a3c613d0 Mon Sep 17 00:00:00 2001 From: Unknown Date: Wed, 28 Mar 2018 20:07:21 +0200 Subject: [PATCH] Default config keys are now fixed (Confusing default configuration values #66) --- src/IMAP/Client.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/IMAP/Client.php b/src/IMAP/Client.php index e1813f6..ca3b15e 100644 --- a/src/IMAP/Client.php +++ b/src/IMAP/Client.php @@ -101,6 +101,13 @@ class Client { */ protected $errors = []; + /** + * All valid and available account config parameters + * + * @var array $validConfigKeys + */ + protected $validConfigKeys = ['host', 'port', 'encryption', 'validate_cert', 'username', 'password']; + /** * Client constructor. * @@ -128,8 +135,8 @@ public function setConfig(array $config) { $defaultAccount = config('imap.default'); $defaultConfig = config("imap.accounts.$defaultAccount"); - foreach($defaultConfig as $key => $default){ - $this->$key = isset($config[$key]) ? $config[$key] : $default; + foreach($this->validConfigKeys as $key){ + $this->$key = isset($config[$key]) ? $config[$key] : $defaultConfig[$key]; } return $this;