From: Andrey Kutejko Date: Sat, 10 Aug 2013 08:55:59 +0000 (+0300) Subject: minor code simplifications X-Git-Url: https://git.andy128k.dev/?a=commitdiff_plain;h=0e2ae9d48bad4ee7962e4e273ef0fae7b3c983a7;p=ipf-mail.git minor code simplifications --- 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; + } } }