Skip to content

Commit

Permalink
Allow either array or config file as parameter to Email::initialize. F…
Browse files Browse the repository at this point in the history
…ixes #1042
  • Loading branch information
lonnieezell committed May 24, 2018
1 parent b2197d5 commit 6ec67e9
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions system/Email/Email.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
* @filesource
*/

use CodeIgniter\Config\BaseConfig;
use Config\Mimes;


Expand Down Expand Up @@ -400,15 +401,20 @@ public function __construct($config = null)
/**
* Initialize preferences
*
* @param array $config
* @param array|\Config\Email $config
*
* @return Email
*/
public function initialize($config)
{
$this->clear();

foreach (get_class_vars(get_class($this)) as $key => $value)
if ($config instanceof \Config\Email)
{
$config = get_class_vars(get_class($this));
}

foreach ($config as $key => $value)
{
if (isset($this->$key) && isset($config->$key))
{
Expand Down

0 comments on commit 6ec67e9

Please sign in to comment.