Refactor code to not use extract()/compact()

This commit is contained in:
mark_story 2013-03-01 22:34:00 -05:00
parent 8eb5ce410a
commit 47526e8b4d

View file

@ -1065,16 +1065,21 @@ class CakeEmail {
$contents = $this->transportClass()->send($this); $contents = $this->transportClass()->send($this);
if (!empty($this->_config['log'])) { if (!empty($this->_config['log'])) {
$level = LOG_DEBUG; $config = array(
$scope = 'email'; 'level' => LOG_DEBUG,
'scope' => 'email'
);
if ($this->_config['log'] !== true) { if ($this->_config['log'] !== true) {
if (!is_array($this->_config['log'])) { if (!is_array($this->_config['log'])) {
$this->_config['log'] = array('level' => $this->_config['log']); $this->_config['log'] = array('level' => $this->_config['log']);
} }
$this->_config['log'] = array_merge(compact('level', 'scope'), $this->_config['log']); $config = array_merge($config, $this->_config['log']);
extract($this->_config['log']);
} }
CakeLog::write($level, PHP_EOL . $contents['headers'] . PHP_EOL . $contents['message'], $scope); CakeLog::write(
$config['level'],
PHP_EOL . $contents['headers'] . PHP_EOL . $contents['message'],
$config['scope']
);
} }
return $contents; return $contents;
} }