From 0e2ae9d48bad4ee7962e4e273ef0fae7b3c983a7 Mon Sep 17 00:00:00 2001 From: Andrey Kutejko Date: Sat, 10 Aug 2013 11:55:59 +0300 Subject: [PATCH] minor code simplifications --- mail/protocol/imap.php | 8 ++++---- mail/transport/abstract.php | 10 +++------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/mail/protocol/imap.php b/mail/protocol/imap.php index 6ac14c2..2e05564 100644 --- a/mail/protocol/imap.php +++ b/mail/protocol/imap.php @@ -247,13 +247,13 @@ class IPF_Mail_Protocol_Imap public function escapeList($list) { $result = array(); - foreach ($list as $k => $v) { - if (!is_array($v)) { + foreach ($list as $v) { + if (is_array($v)) { + $result[] = $this->escapeList($v); + } else { // $result[] = $this->escapeString($v); $result[] = $v; - continue; } - $result[] = $this->escapeList($v); } return '(' . implode(' ', $result) . ')'; } diff --git a/mail/transport/abstract.php b/mail/transport/abstract.php index 91dcfcb..ea98e19 100644 --- a/mail/transport/abstract.php +++ b/mail/transport/abstract.php @@ -42,11 +42,6 @@ abstract class IPF_Mail_Transport_Abstract return $this->_headers; } - protected static function _formatHeader(&$item, $key, $prefix) - { - $item = $prefix . ': ' . $item; - } - protected function _prepareHeaders($headers) { if (!$this->_mail) { @@ -61,8 +56,9 @@ abstract class IPF_Mail_Transport_Abstract $value = implode(',' . $this->EOL . ' ', $content); $this->header .= $header . ': ' . $value . $this->EOL; } else { - array_walk($content, array(get_class($this), '_formatHeader'), $header); - $this->header .= implode($this->EOL, $content) . $this->EOL; + foreach ($content as $value) { + $this->header .= $header . ': ' . $value . $this->EOL; + } } } -- 2.49.0