Making FormHelper::inputDefaults() code more readable

This commit is contained in:
Tigran Gabrielyan 2012-05-21 13:56:51 -07:00
parent e58e3c5314
commit 671c31218f

View file

@ -2592,7 +2592,11 @@ class FormHelper extends AppHelper {
*/
public function inputDefaults($defaults = null, $merge = false) {
if (!is_null($defaults)) {
$this->_inputDefaults = array_merge($merge ? $this->_inputDefaults : array(), (array)$defaults);
if ($merge) {
$this->_inputDefaults = array_merge($this->_inputDefaults, (array)$defaults);
} else {
$this->_inputDefaults = (array)$defaults;
}
}
return $this->_inputDefaults;
}