Skip to content

Commit

Permalink
remove each() method
Browse files Browse the repository at this point in the history
  • Loading branch information
rahulk-k authored Nov 13, 2020
1 parent 1ae1ae9 commit fa3e16c
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,11 @@ public function getFrom()
{
$fromMail = null;
reset($this->from);
list($email, $name) = each($this->from);
if (is_numeric($email) === true) {
$fromMail = $name;

if (is_numeric(key($this->from)) === true) {
$fromMail = $this->from[0];
} else {
$fromMail = $email;
$fromMail = key($this->from);
}
return $fromMail;
}
Expand All @@ -150,9 +150,9 @@ public function getFrom()
public function getFromName()
{
reset($this->from);
list($email, $name) = each($this->from);
if (is_numeric($email) === false) {
return $name;

if (is_numeric(key($this->from)) === false) {
return current($this->from);
} else {
return null;
}
Expand Down Expand Up @@ -195,11 +195,11 @@ public function getReplyTo()
$replyTo = null;
if (is_array($this->replyTo) === true) {
reset($this->replyTo);
list($email, $name) = each($this->replyTo);
if (is_numeric($email) === true) {
$replyTo = $name;

if (is_numeric(key($this->replyTo)) === true) {
$replyTo = $this->replyTo[0];
} else {
$replyTo = $email;
$replyTo = key($this->replyTo);
}
}
return $replyTo;
Expand Down Expand Up @@ -556,4 +556,4 @@ public function send(MailerInterface $mailer = null)
}


}
}

0 comments on commit fa3e16c

Please sign in to comment.