From fa3e16c1a380d8883810a81083180de13942aa2b Mon Sep 17 00:00:00 2001 From: Rahul Koshta Date: Fri, 13 Nov 2020 12:14:43 +0530 Subject: [PATCH] remove each() method --- Message.php | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/Message.php b/Message.php index dadd7a0..76b5ff3 100644 --- a/Message.php +++ b/Message.php @@ -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; } @@ -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; } @@ -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; @@ -556,4 +556,4 @@ public function send(MailerInterface $mailer = null) } -} \ No newline at end of file +}