Simply the code.

This commit is contained in:
Juan Basso 2011-03-01 19:58:04 -03:00
parent 03b4ce070b
commit 30dced741d

View file

@ -375,26 +375,21 @@ class CakeEmail {
throw new SocketException(__('Invalid email: "%s"', $email));
}
if ($name === null) {
$this->{$varName} = array($email => $email);
} else {
$this->{$varName} = array($email => $name);
$name = $email;
}
$this->{$varName} = array($email => $name);
return;
}
$list = array();
foreach ($email as $key => $value) {
if (is_int($key)) {
if (!Validation::email($value)) {
throw new SocketException(__('Invalid email: "%s"', $value));
$key = $value;
}
$list[$value] = $value;
} else {
if (!Validation::email($key)) {
throw new SocketException(__('Invalid email: "%s"', $key));
}
$list[$key] = $value;
}
}
$this->{$varName} = $list;
}
@ -431,26 +426,21 @@ class CakeEmail {
throw new SocketException(__('Invalid email: "%s"', $email));
}
if ($name === null) {
$this->{$varName}[$email] = $email;
} else {
$this->{$varName}[$email] = $name;
$name = $email;
}
$this->{$varName}[$email] = $name;
return;
}
$list = array();
foreach ($email as $key => $value) {
if (is_int($key)) {
if (!Validation::email($value)) {
throw new SocketException(__('Invalid email: "%s"', $value));
$key = $value;
}
$list[$value] = $value;
} else {
if (!Validation::email($key)) {
throw new SocketException(__('Invalid email: "%s"', $key));
}
$list[$key] = $value;
}
}
$this->{$varName} = array_merge($this->{$varName}, $list);
}