Skip to content

Commit d51e265

Browse files
committed
Default config keys are now fixed (Confusing default configuration values #66)
1 parent 665c23a commit d51e265

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/IMAP/Client.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,13 @@ class Client {
101101
*/
102102
protected $errors = [];
103103

104+
/**
105+
* All valid and available account config parameters
106+
*
107+
* @var array $validConfigKeys
108+
*/
109+
protected $validConfigKeys = ['host', 'port', 'encryption', 'validate_cert', 'username', 'password'];
110+
104111
/**
105112
* Client constructor.
106113
*
@@ -128,8 +135,8 @@ public function setConfig(array $config) {
128135
$defaultAccount = config('imap.default');
129136
$defaultConfig = config("imap.accounts.$defaultAccount");
130137

131-
foreach($defaultConfig as $key => $default){
132-
$this->$key = isset($config[$key]) ? $config[$key] : $default;
138+
foreach($this->validConfigKeys as $key){
139+
$this->$key = isset($config[$key]) ? $config[$key] : $defaultConfig[$key];
133140
}
134141

135142
return $this;

0 commit comments

Comments
 (0)