Skip to content

Commit

Permalink
Default config keys are now fixed (Confusing default configuration va…
Browse files Browse the repository at this point in the history
…lues #66)
  • Loading branch information
Webklex committed Mar 28, 2018
1 parent 665c23a commit d51e265
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/IMAP/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit d51e265

Please sign in to comment.